Esempio n. 1
0
 internal PartialStructTypeWithCodeAnalysis(InternalStructTypeWithCodeAnalysis <TStruct> classType)
 {
     this.structType = classType;
     members         = classType.Members;
     classes         = new PartialStructNestedClassCollectionWithCodeAnalysis(classType.Classes);
     constructors    = new WrappedCollection <StructConstructorWithCodeAnalysis, PartialStructConstructorWithCodeAnalysis>(
         classType.Constructors,
         constructor => new PartialStructConstructorWithCodeAnalysis(constructor),
         constructor => constructor.Constructor,
         value => classType.Constructors = value);
     delegates = new WrappedCollection <StructNestedDelegateWithCodeAnalysis, PartialStructNestedDelegateWithCodeAnalysis>(
         classType.Delegates,
         parent => new PartialStructNestedDelegateWithCodeAnalysis(parent),
         child => child.Delegate,
         value => classType.Delegates = value);
     enums = new WrappedCollection <StructNestedEnumWithCodeAnalysis, PartialStructNestedEnumWithCodeAnalysis>(
         classType.Enums,
         parent => new PartialStructNestedEnumWithCodeAnalysis(parent),
         child => child.Enum,
         value => classType.Enums = value);
     events     = new PartialStructEventCollectionWithCodeAnalysis(classType.Events);
     fields     = new PartialStructFieldCollectionWithCodeAnalysis(classType.Fields);
     indexers   = new PartialStructIndexerCollectionWithCodeAnalysis(classType.Indexers);
     interfaces = new WrappedCollection <StructNestedInterfaceWithCodeAnalysis, PartialStructNestedInterfaceWithCodeAnalysis>(
         classType.Interfaces,
         parent => new PartialStructNestedInterfaceWithCodeAnalysis(parent),
         child => child.Interface,
         value => classType.Interfaces = value);
     methods    = new InternalPartialStructMethodCollectionWithCodeAnalysis <TStruct>(classType);
     properties = new PartialStructPropertyCollectionWithCodeAnalysis(classType.Properties);
     structs    = new PartialStructNestedStructCollectionWithCodeAnalysis(classType.Structs);
 }
        internal PartialStructWithCodeAnalysis(DocumentWithCodeAnalysis document)
        {
            var type = new InternalStructTypeWithCodeAnalysis <PartialStructWithCodeAnalysis>(this);

            structType  = new StructWithCodeAnalysis(document, type);
            partialType = new PartialStructTypeWithCodeAnalysis <PartialStructWithCodeAnalysis>(type);
        }
Esempio n. 3
0
 internal InternalPartialStructMethodCollectionWithCodeAnalysis(
     InternalStructTypeWithCodeAnalysis <TStruct> structType)
 {
     this.structType = structType;
     methods         = new StructMethodListWrapper <TStruct, StructMethodWithCodeAnalysis>(
         structType.InternalNode,
         () => new StructMethodWithCodeAnalysis(),
         syntax => syntax.ExplicitInterfaceSpecifier == null && !syntax.Modifiers.IsAbstract() && !syntax.IsPartial());
     partialMethodDefinitions = new StructMethodListWrapper <TStruct, PartialMethodDefinitionWithCodeAnalysis>(
         structType.InternalNode,
         () => new PartialMethodDefinitionWithCodeAnalysis(),
         syntax => syntax.IsPartial() && syntax.Body == null);
     partialMethodImplementations = new StructMethodListWrapper <TStruct, PartialMethodImplementationWithCodeAnalysis>(
         structType.InternalNode,
         () => new PartialMethodImplementationWithCodeAnalysis(),
         syntax => syntax.IsPartial() && syntax.Body != null);
 }
        internal static StructNestedPartialClassCollectionWithCodeAnalysis Create <TStruct>(
            InternalStructTypeWithCodeAnalysis <TStruct> structType)
            where TStruct : class, IHasNode <StructDeclarationSyntax>
        {
            var classes = new StructTypeMemberListWrapper <TStruct, StructNestedPartialClassWithCodeAnalysis, ClassDeclarationSyntax>(
                structType.InternalNode,
                () => new StructNestedPartialClassWithCodeAnalysis(),
                ClassDeclarationSyntaxExtensions.IsPartialClass);
            var abstractClasses = new StructTypeMemberListWrapper <TStruct, StructNestedAbstractPartialClassWithCodeAnalysis, ClassDeclarationSyntax>(
                structType.InternalNode,
                () => new StructNestedAbstractPartialClassWithCodeAnalysis(),
                ClassDeclarationSyntaxExtensions.IsAbstractPartialClass);
            var sealedClasses = new StructTypeMemberListWrapper <TStruct, StructNestedSealedPartialClassWithCodeAnalysis, ClassDeclarationSyntax>(
                structType.InternalNode,
                () => new StructNestedSealedPartialClassWithCodeAnalysis(),
                ClassDeclarationSyntaxExtensions.IsSealedPartialClass);
            var staticClasses = new StructTypeMemberListWrapper <TStruct, StructNestedStaticPartialClassWithCodeAnalysis, ClassDeclarationSyntax>(
                structType.InternalNode,
                () => new StructNestedStaticPartialClassWithCodeAnalysis(),
                ClassDeclarationSyntaxExtensions.IsStaticPartialClass);

            return(new StructNestedPartialClassCollectionWithCodeAnalysis(structType.Members, abstractClasses, classes, sealedClasses, staticClasses));
        }