提交 17750086 编写于 作者: E Eugene Auduchinok 提交者: Phillip Carter

Add FSharpUnionCase.HasFields (#7841)

上级 08598514
......@@ -781,9 +781,13 @@ and FSharpUnionCase(cenv, v: UnionCaseRef) =
checkIsResolved()
v.Range
member __.HasFields =
if isUnresolved() then false else
v.UnionCase.RecdFieldsArray.Length <> 0
member __.UnionCaseFields =
if isUnresolved() then makeReadOnlyCollection [] else
v.UnionCase.RecdFields |> List.mapi (fun i _ -> FSharpField(cenv, FSharpFieldData.Union (v, i))) |> makeReadOnlyCollection
v.UnionCase.RecdFieldsArray |> Array.mapi (fun i _ -> FSharpField(cenv, FSharpFieldData.Union (v, i))) |> makeReadOnlyCollection
member __.ReturnType =
checkIsResolved()
......
......@@ -382,6 +382,9 @@ and [<Class>] public FSharpUnionCase =
/// Get the range of the name of the case
member DeclarationLocation : range
/// Indicates if the union case has field definitions
member HasFields: bool
/// Get the data carried by the case.
member UnionCaseFields: IList<FSharpField>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册