Skip to content

Commit

Permalink
General stabilization. Ignore when we cannot handle a module, type or…
Browse files Browse the repository at this point in the history
… a single member and write an error, workaround for #271 (and future FCS bugs).
  • Loading branch information
matthid committed Sep 20, 2015
1 parent 38decc6 commit 771b430
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
21 changes: 13 additions & 8 deletions src/FSharp.MetadataFormat/Main.fs
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,17 @@ module Reader =
/// Reads XML documentation comments and calls the specified function
/// to parse the rest of the entity, unless [omit] command is set.
/// The function is called with category name, commands & comment.
let readCommentsInto ctx xmlDoc f =
let readCommentsInto name ctx xmlDoc f =
let cmds, comment = readCommentAndCommands ctx xmlDoc
match cmds with
| Command "omit" _ -> None
| Command "category" cat
| Let "" (cat, _) -> Some(f cat cmds comment)
| Let "" (cat, _) ->
try
Some(f cat cmds comment)
with e ->
Log.errorf "Could read comments from entity '%s': %O" name e
None

let checkAccess ctx (access: FSharpAccessibility) =
not ctx.PublicOnly || access.IsPublic
Expand All @@ -809,7 +814,7 @@ module Reader =
|> List.ofSeq

let tryReadMember (ctx:ReadingContext) kind (memb:FSharpMemberOrFunctionOrValue) =
readCommentsInto ctx (getXmlDocSigForMember memb) (fun cat _ comment ->
readCommentsInto memb.FullName ctx (getXmlDocSigForMember memb) (fun cat _ comment ->
Member.Create(memb.DisplayName, kind, cat, readMemberOrVal ctx memb, comment))

let readAllMembers ctx kind (members:seq<FSharpMemberOrFunctionOrValue>) =
Expand Down Expand Up @@ -837,22 +842,22 @@ module Reader =
|> List.ofSeq
|> List.filter (fun v -> checkAccess ctx v.Accessibility)
|> List.choose (fun case ->
readCommentsInto ctx case.XmlDocSig (fun cat _ comment ->
readCommentsInto case.FullName ctx case.XmlDocSig (fun cat _ comment ->
Member.Create(case.Name, MemberKind.UnionCase, cat, readUnionCase ctx case, comment)))

let readRecordFields ctx (typ:FSharpEntity) =
typ.FSharpFields
|> List.ofSeq
|> List.filter (fun field -> not field.IsCompilerGenerated)
|> List.choose (fun field ->
readCommentsInto ctx field.XmlDocSig (fun cat _ comment ->
readCommentsInto field.FullName ctx field.XmlDocSig (fun cat _ comment ->
Member.Create(field.Name, MemberKind.RecordField, cat, readFSharpField ctx field, comment)))

let readStaticParams ctx (typ:FSharpEntity) =
typ.StaticParameters
|> List.ofSeq
|> List.choose (fun staticParam ->
readCommentsInto ctx (getFSharpStaticParamXmlSig typ staticParam.Name) (fun cat _ comment ->
readCommentsInto staticParam.FullName ctx (getFSharpStaticParamXmlSig typ staticParam.Name) (fun cat _ comment ->
Member.Create(staticParam.Name, MemberKind.StaticParameter, cat, readFSharpStaticParam ctx staticParam, comment)))

// ----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -890,7 +895,7 @@ module Reader =
if typ.IsProvided && typ.XmlDoc.Count > 0 then
registerTypeProviderXmlDocs ctx typ
let xmlDocSig = getXmlDocSigForType typ
readCommentsInto ctx xmlDocSig (fun cat cmds comment ->
readCommentsInto typ.FullName ctx xmlDocSig (fun cat cmds comment ->
let urlName = ctx.UrlMap.GetUrl typ

let rec getMembers (typ:FSharpEntity) = [
Expand Down Expand Up @@ -941,7 +946,7 @@ module Reader =
( name, cat, urlName, comment, ctx.Assembly, cases, fields, statParams, ctors, inst, stat ))

and readModule (ctx:ReadingContext) (modul:FSharpEntity) =
readCommentsInto ctx modul.XmlDocSig (fun cat cmd comment ->
readCommentsInto modul.FullName ctx modul.XmlDocSig (fun cat cmd comment ->

// Properties & value bindings in the module
let urlName = ctx.UrlMap.GetUrl modul
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ private void PrivateMethod() { }
/// <summary>
/// My_Private_Event
/// </summary>
private event EventHandler PrivateEvent;
private event EventHandler PrivateEvent;

/// <summary>
/// Event triggered when WorklistText is required
/// </summary>
public delegate void WorklistTextRequested(int medicalRecordId, string accessionNo,
int templateId, string specificationCode, string specificationText, string aeTitle);

/// <summary>
/// Some Event with its own delegate
/// </summary>
public event WorklistTextRequested OnWorklistTextRequested;
}
}

0 comments on commit 771b430

Please sign in to comment.