protected UnionPartBase([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder, bool hasPublicNestedTypes, bool isSingleCaseUnion) : base(declaration, cacheBuilder) { HasPublicNestedTypes = hasPublicNestedTypes; RepresentationAccessRights = GetRepresentationAccessRights(declaration); IsSingleCaseUnion = isSingleCaseUnion; }
public static bool HasAttribute([NotNull] this IFSharpTypeDeclaration typeDeclaration, [NotNull] string shortName) { foreach (var attr in typeDeclaration.Attributes) { if (attr.ShortNameEquals(shortName)) { return(true); } } return(false); }
public static INestedModuleDeclaration GetAssociatedModuleDeclaration( [NotNull] this IFSharpTypeDeclaration typeDeclaration) { if (!(typeDeclaration.Parent is IModuleLikeDeclaration parentModule)) { return(null); } foreach (var moduleDeclaration in parentModule.Children <INestedModuleDeclaration>()) { if (moduleDeclaration.GetAssociatedTypeDeclaration(out _) == typeDeclaration) { return(moduleDeclaration); } } return(null); }
protected FSharpFunctionBase([NotNull] ITypeMemberDeclaration declaration, [NotNull] FSharpMemberOrFunctionOrValue mfv, [CanBeNull] IFSharpTypeDeclaration typeDeclaration) : base(declaration, mfv) { var mfvTypeParams = mfv.GenericParameters; var typeParams = new FrugalLocalList <ITypeParameter>(); var outerTypeParamsCount = typeDeclaration?.TypeParameters.Count ?? 0; for (var i = outerTypeParamsCount; i < mfvTypeParams.Count; i++) { typeParams.Add(new FSharpTypeParameterOfMethod(this, mfvTypeParams[i].DisplayName, i - outerTypeParamsCount)); } TypeParameters = typeParams.ToList(); ReturnType = mfv.IsConstructor || mfv.ReturnParameter.Type.IsUnit ? Module.GetPredefinedType().Void : FSharpTypesUtil.GetType(mfv.ReturnParameter.Type, declaration, TypeParameters, Module, true) ?? TypeFactory.CreateUnknownType(Module); var methodParams = new FrugalLocalList <IParameter>(); var mfvParamGroups = mfv.CurriedParameterGroups; if (mfvParamGroups.Count == 1 && mfvParamGroups[0].Count == 1 && mfvParamGroups[0][0].Type.IsUnit) { Parameters = EmptyList <IParameter> .InstanceList; return; } foreach (var paramsGroup in mfv.CurriedParameterGroups) { foreach (var param in paramsGroup) { var paramType = param.Type; var paramName = param.DisplayName; methodParams.Add(new FSharpMethodParameter(param, this, methodParams.Count, FSharpTypesUtil.GetParameterKind(param), FSharpTypesUtil.GetType(paramType, declaration, TypeParameters, Module, false), paramName.IsEmpty() ? SharedImplUtil.MISSING_DECLARATION_NAME : paramName)); } } Parameters = methodParams.ToList(); }
private Part CreateObjectTypePart(IFSharpTypeDeclaration decl, bool isExtension) { switch (decl.TypePartKind) { case PartKind.Class: return(isExtension ? (Part) new ClassExtensionPart(decl, Builder) : new ClassPart(decl, Builder)); case PartKind.Struct: return(isExtension ? (Part) new StructExtensionPart(decl, Builder) : new StructPart(decl, Builder)); case PartKind.Interface: return(new InterfacePart(decl, Builder)); case PartKind.Enum: return(new EnumPart(decl, Builder)); default: throw new ArgumentOutOfRangeException(); } }
protected RecordPartBase([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder) { CliMutable = declaration.HasAttribute("CLIMutable"); RepresentationAccessRights = declaration.GetRepresentationAccessRights(); }
public InterfacePart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder) { }
public HiddenTypePart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder) { }
internal FSharpConversionOperator([NotNull] ITypeMemberDeclaration declaration, [NotNull] FSharpMemberOrFunctionOrValue mfv, [CanBeNull] IFSharpTypeDeclaration typeDeclaration, bool isExplicitCast) : base(declaration, mfv, typeDeclaration) { myIsExplicitCast = isExplicitCast; }
protected SimpleTypePartBase([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder) { }
public ExceptionPart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder) { }
protected TypeAbbreviationOrDeclarationPartBase([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder, false, true) { }
public FSharpConstructor([NotNull] ITypeMemberDeclaration declaration, [NotNull] FSharpMemberOrFunctionOrValue mfv, [CanBeNull] IFSharpTypeDeclaration typeDeclaration) : base(declaration, mfv, typeDeclaration) { }
protected FSharpConstructorBase([NotNull] ITypeMemberDeclaration declaration, [NotNull] FSharpMemberOrFunctionOrValue mfv, IFSharpTypeDeclaration typeDeclaration) : base(declaration, mfv, typeDeclaration) { }
public UnionPart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder, bool hasNestedTypes, bool isSingleCase) : base(declaration, cacheBuilder, hasNestedTypes, isSingleCase) { }
public StructUnionPart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder, bool isSingleCase) : base(declaration, cacheBuilder, false, isSingleCase) { }
public RecordPart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder) { HasCliMutable = declaration.Attributes.Any(attr => attr.ShortNameEquals("CLIMutable")); // todo: resolve }
internal FSharpOperator([NotNull] ITypeMemberDeclaration declaration, [NotNull] FSharpMemberOrFunctionOrValue mfv, [CanBeNull] IFSharpTypeDeclaration typeDeclaration) : base(declaration, mfv, typeDeclaration) { }
protected RecordPartBase([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder) =>
protected FSharpMethodBase([NotNull] ITypeMemberDeclaration declaration, [NotNull] FSharpMemberOrFunctionOrValue mfv, [CanBeNull] IFSharpTypeDeclaration typeDeclaration) : base(declaration, mfv, typeDeclaration) { ShortName = mfv.GetMemberCompiledName(); }
private void ProcessHiddenTypeDeclaration(IFSharpTypeDeclaration decl) => ProcessPart(new HiddenTypePart(decl, Builder));
public StructExtensionPart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder) { }
public StructUnionPart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder, bool hasPublicNestedTypes) : base(declaration, cacheBuilder, hasPublicNestedTypes) { }
public StructTypeAbbreviationOrDeclarationPart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder) : base(declaration, cacheBuilder) { }
protected UnionPartBase([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder, bool hasPublicNestedTypes) : base(declaration, cacheBuilder) =>
public ModuleFunction([NotNull] ITypeMemberDeclaration declaration, [NotNull] FSharpMemberOrFunctionOrValue mfv, [CanBeNull] IFSharpTypeDeclaration typeDeclaration) : base(declaration, mfv, typeDeclaration) { }
protected FSharpMethodBase([NotNull] ITypeMemberDeclaration declaration, [NotNull] FSharpMemberOrFunctionOrValue mfv, [CanBeNull] IFSharpTypeDeclaration typeDeclaration) : base(declaration, mfv, typeDeclaration) { }