public static IEnumerable <IDeclaredElement> GetGeneratedMembers([NotNull] this IUnionCase unionCase) { if (!(unionCase.GetContainingType().GetPart <IUnionPart>() is { } unionPart)) { return(EmptyList <IDeclaredElement> .Instance); } if (unionPart.IsSingleCase && !unionCase.HasFields) { return(EmptyList <IDeclaredElement> .Instance); } var result = new List <IDeclaredElement>(); if (unionCase.HasFields) { result.Add(new FSharpUnionCaseNewMethod(unionCase)); if (unionCase.NestedType is { } nestedType) { result.Add(nestedType); } } if (unionPart.IsSingleCase) { return(result); } result.Add(new FSharpUnionCaseIsCaseProperty(unionCase)); result.Add(new FSharpUnionCaseTag(unionCase)); return(result); }
public static IEnumerable <IDeclaredElement> GetGeneratedMembers([NotNull] this IUnionCase unionCase) { if (!(unionCase.GetContainingType().GetUnionPart() is IUnionPart unionPart)) { return(EmptyList <IDeclaredElement> .Instance); } if (unionPart.IsSingleCaseUnion && unionCase is FSharpUnionCaseProperty) { return(EmptyList <IDeclaredElement> .Instance); } var result = new List <IDeclaredElement>(); if (unionCase is FSharpNestedTypeUnionCase) { result.Add(new NewUnionCaseMethod(unionCase)); } if (unionPart.IsSingleCaseUnion) { return(result); } result.Add(new IsUnionCaseProperty(unionCase)); result.Add(new UnionCaseTag(unionCase)); return(result); }
private static IEnumerable <RelatedDeclaredElement> GetUnionCaseRelatedElements([NotNull] IUnionCase unionCase) => unionCase.GetGeneratedMembers().Select(member => new RelatedDeclaredElement(member));
public NewUnionCaseMethod([NotNull] IUnionCase unionCase) =>
public FSharpUnionCaseNewMethod([NotNull] IUnionCase unionCase) =>
public FSharpUnionCaseTag(IUnionCase unionCase) =>
internal IsUnionCaseProperty([NotNull] IUnionCase unionCase) =>
internal FSharpUnionCaseIsCaseProperty([NotNull] IUnionCase unionCase) =>
public UnionCaseTag(IUnionCase unionCase) =>