Exemplo n.º 1
0
        internal PartialClassWithCodeAnalysis(DocumentWithCodeAnalysis document)
        {
            var type = new InternalClassTypeWithCodeAnalysis <PartialClassWithCodeAnalysis>(this);

            classType   = new ClassWithCodeAnalysis(document, type);
            partialType = new PartialClassTypeWithCodeAnalysis <PartialClassWithCodeAnalysis>(type);
        }
 internal InternalPartialClassMethodCollectionWithCodeAnalysis(InternalClassTypeWithCodeAnalysis <TClass> classType)
 {
     this.classType = classType;
     methods        = new ClassMethodListWrapper <TClass, ClassMethodWithCodeAnalysis>(
         classType.InternalNode,
         () => new ClassMethodWithCodeAnalysis(),
         syntax => syntax.ExplicitInterfaceSpecifier == null && !syntax.Modifiers.IsAbstract() && !syntax.IsPartial());
     partialMethodDefinitions = new ClassMethodListWrapper <TClass, PartialMethodDefinitionWithCodeAnalysis>(
         classType.InternalNode,
         () => new PartialMethodDefinitionWithCodeAnalysis(),
         syntax => syntax.IsPartial() && syntax.Body == null);
     partialMethodImplementations = new ClassMethodListWrapper <TClass, PartialMethodImplementationWithCodeAnalysis>(
         classType.InternalNode,
         () => new PartialMethodImplementationWithCodeAnalysis(),
         syntax => syntax.IsPartial() && syntax.Body != null);
     classType.Members.AddClassPartialMethods(this);
 }
Exemplo n.º 3
0
 internal PartialClassTypeWithCodeAnalysis(InternalClassTypeWithCodeAnalysis <TClass> classType)
 {
     this.classType = classType;
     members        = classType.Members;
     classes        = new PartialClassNestedClassCollectionWithCodeAnalysis(classType.Classes);
     constructors   = new WrappedCollection <ClassConstructorWithCodeAnalysis, PartialClassConstructorWithCodeAnalysis>(
         classType.Constructors,
         constructor => new PartialClassConstructorWithCodeAnalysis(constructor),
         constructor => constructor.Constructor,
         value => classType.Constructors = value);
     conversionOperators = new WrappedCollection <ClassConversionOperatorWithCodeAnalysis, PartialClassConversionOperatorWithCodeAnalysis>(
         classType.ConversionOperators,
         parent => new PartialClassConversionOperatorWithCodeAnalysis(parent),
         child => child.ConversionOperator,
         value => classType.ConversionOperators = value);
     delegates = new WrappedCollection <ClassNestedDelegateWithCodeAnalysis, PartialClassNestedDelegateWithCodeAnalysis>(
         classType.Delegates,
         parent => new PartialClassNestedDelegateWithCodeAnalysis(parent),
         child => child.InternalDelegate,
         value => classType.Delegates = value);
     enums = new WrappedCollection <ClassNestedEnumWithCodeAnalysis, PartialClassNestedEnumWithCodeAnalysis>(
         classType.Enums,
         parent => new PartialClassNestedEnumWithCodeAnalysis(parent),
         child => child.Enum,
         value => classType.Enums = value);
     events     = new PartialClassEventCollectionWithCodeAnalysis(classType.Events);
     fields     = new PartialClassFieldCollectionWithCodeAnalysis(classType.Fields);
     indexers   = new PartialClassIndexerCollectionWithCodeAnalysis(classType.Indexers);
     interfaces = new WrappedCollection <ClassNestedInterfaceWithCodeAnalysis, PartialClassNestedInterfaceWithCodeAnalysis>(
         classType.Interfaces,
         parent => new PartialClassNestedInterfaceWithCodeAnalysis(parent),
         child => child.Interface,
         value => classType.Interfaces = value);
     operatorOverloads = new WrappedCollection <ClassOperatorOverloadWithCodeAnalysis, PartialClassOperatorOverloadWithCodeAnalysis>(
         classType.OperatorOverloads,
         parent => new PartialClassOperatorOverloadWithCodeAnalysis(parent),
         child => child.OperatorOverload,
         value => classType.OperatorOverloads = value);
     methods    = new InternalPartialClassMethodCollectionWithCodeAnalysis <TClass>(classType);
     properties = new PartialClassPropertyCollectionWithCodeAnalysis(classType.Properties);
     structs    = new PartialClassNestedStructCollectionWithCodeAnalysis(classType.Structs);
 }
        internal static ClassNestedPartialClassCollectionWithCodeAnalysis Create <TClass>(
            InternalClassTypeWithCodeAnalysis <TClass> classType)
            where TClass : class, IHasNode <ClassDeclarationSyntax>
        {
            var classes = new ClassMemberListWrapper <TClass, ClassNestedPartialClassWithCodeAnalysis, ClassDeclarationSyntax>(
                classType.InternalNode,
                () => new ClassNestedPartialClassWithCodeAnalysis(),
                ClassDeclarationSyntaxExtensions.IsPartialClass);
            var abstractClasses = new ClassMemberListWrapper <TClass, ClassNestedAbstractPartialClassWithCodeAnalysis, ClassDeclarationSyntax>(
                classType.InternalNode,
                () => new ClassNestedAbstractPartialClassWithCodeAnalysis(),
                ClassDeclarationSyntaxExtensions.IsAbstractPartialClass);
            var sealedClasses = new ClassMemberListWrapper <TClass, ClassNestedSealedPartialClassWithCodeAnalysis, ClassDeclarationSyntax>(
                classType.InternalNode,
                () => new ClassNestedSealedPartialClassWithCodeAnalysis(),
                ClassDeclarationSyntaxExtensions.IsSealedPartialClass);
            var staticClasses = new ClassMemberListWrapper <TClass, ClassNestedStaticPartialClassWithCodeAnalysis, ClassDeclarationSyntax>(
                classType.InternalNode,
                () => new ClassNestedStaticPartialClassWithCodeAnalysis(),
                ClassDeclarationSyntaxExtensions.IsStaticPartialClass);

            return(new ClassNestedPartialClassCollectionWithCodeAnalysis(classType.Members, abstractClasses, classes, sealedClasses, staticClasses));
        }