Пример #1
0
 public InternalStaticTypeWithCodeAnalysis(TClass @class)
 {
     node       = new Node <TClass, ClassDeclarationSyntax>(@class);
     attributes = new AttributeListWrapper <TClass, ClassDeclarationSyntax>(
         node,
         syntax => syntax.AttributeLists,
         (parentSyntax, childSyntax) => parentSyntax.WithAttributeLists(childSyntax));
     classes   = new InternalStaticClassNestedClassCollectionWithCodeAnalysis <TClass>(this);
     delegates = new ClassMemberListWrapper <TClass, StaticClassNestedDelegateWithCodeAnalysis, DelegateDeclarationSyntax>(
         node,
         () => new StaticClassNestedDelegateWithCodeAnalysis());
     enums = new ClassMemberListWrapper <TClass, StaticClassNestedEnumWithCodeAnalysis, EnumDeclarationSyntax>(
         node,
         () => new StaticClassNestedEnumWithCodeAnalysis());
     events            = new InternalStaticClassEventCollectionWithCodeAnalysis <TClass>(this);
     fields            = new InternalStaticClassFieldCollectionWithCodeAnalysis <TClass>(this);
     genericParameters = new GenericParameterDeclarationNodeList <TClass, ClassDeclarationSyntax>(
         node,
         syntax => syntax.TypeParameterList,
         (parentSyntax, childSyntax) => parentSyntax.WithTypeParameterList(childSyntax),
         syntax => syntax.ConstraintClauses,
         (parentSyntax, childSyntax) => parentSyntax.WithConstraintClauses(childSyntax));
     interfaces = new ClassMemberListWrapper <TClass, StaticClassNestedInterfaceWithCodeAnalysis, InterfaceDeclarationSyntax>(
         node,
         () => new StaticClassNestedInterfaceWithCodeAnalysis());
     methods           = new InternalStaticClassMethodCollectionWithCodeAnalysis <TClass>(this);
     properties        = new InternalStaticClassPropertyCollectionWithCodeAnalysis <TClass>(this);
     staticConstructor = new ClassMemberListWrapper <TClass, StaticConstructorWithCodeAnalysis, ConstructorDeclarationSyntax>(
         node,
         () => new StaticConstructorWithCodeAnalysis());
     structs = new InternalStaticClassNestedStructCollectionWithCodeAnalysis <TClass>(this);
     members = new MemberList <TClass, ClassDeclarationSyntax>(
         node,
         (parentSyntax, childSyntax) => parentSyntax.WithMembers(childSyntax))
     {
         { nameof(fields.Constants), () => fields.Constants.Select(item => item.Syntax) },
         { nameof(fields.Fields), () => fields.Fields.Select(item => item.Syntax) },
         { nameof(Enums), () => enums.Select(item => item.Syntax) },
         { nameof(Delegates), () => delegates.Select(item => item.Syntax) },
         { nameof(events.Events), () => events.Events.Select(item => item.Syntax) },
         { nameof(events.EventProperties), () => events.EventProperties.Select(item => item.Syntax) },
         { nameof(Interfaces), () => interfaces.Select(item => item.Syntax) },
         { nameof(Properties), () => Properties.Select(item => item.Syntax) },
         { nameof(methods.ExtensionMethods), () => methods.ExtensionMethods.Select(item => item.Syntax) },
         { nameof(methods.Methods), () => methods.Methods.Select(item => item.Syntax) }
     };
 }
 internal InternalClassTypeWithCodeAnalysis(TClass @class)
 {
     node      = new Node <TClass, ClassDeclarationSyntax>(@class);
     baseTypes = new BaseTypeNodeList <TClass, ClassDeclarationSyntax>(
         node,
         (parentSyntax, childSyntax) => parentSyntax.WithBaseList(childSyntax));
     attributes = new AttributeListWrapper <TClass, ClassDeclarationSyntax>(
         node,
         syntax => syntax.AttributeLists,
         (parentSyntax, childSyntax) => parentSyntax.WithAttributeLists(childSyntax));
     baseClass = new WrappedList <InterfaceReferenceWithCodeAnalysis, ClassReferenceWithCodeAnalysis>(
         baseTypes,
         @interface => new ClassReferenceWithCodeAnalysis(@interface.TypeReference),
         newClass => new InterfaceReferenceWithCodeAnalysis(newClass.TypeReference),
         classToFilter => !Regex.IsMatch(classToFilter.Name, "^I[A-Z]"));
     classes      = new InternalClassNestedClassCollectionWithCodeAnalysis <TClass>(this);
     constructors = new ClassMemberListWrapper <TClass, ClassConstructorWithCodeAnalysis, ConstructorDeclarationSyntax>(
         node,
         () => new ClassConstructorWithCodeAnalysis(),
         syntax => !syntax.IsStatic());
     conversionOperators = new ClassMemberListWrapper <TClass, ClassConversionOperatorWithCodeAnalysis, ConversionOperatorDeclarationSyntax>(
         node,
         () => new ClassConversionOperatorWithCodeAnalysis());
     destructor = new ClassMemberListWrapper <TClass, ClassDestructorWithCodeAnalysis, DestructorDeclarationSyntax>(
         node,
         () => new ClassDestructorWithCodeAnalysis());
     delegates = new ClassMemberListWrapper <TClass, ClassNestedDelegateWithCodeAnalysis, DelegateDeclarationSyntax>(
         node,
         () => new ClassNestedDelegateWithCodeAnalysis());
     enums = new ClassMemberListWrapper <TClass, ClassNestedEnumWithCodeAnalysis, EnumDeclarationSyntax>(
         node,
         () => new ClassNestedEnumWithCodeAnalysis());
     events            = new InternalClassEventCollectionWithCodeAnalysis <TClass>(this);
     fields            = new InternalClassFieldCollectionWithCodeAnalysis <TClass>(this);
     genericParameters = new GenericParameterDeclarationNodeList <TClass, ClassDeclarationSyntax>(
         node,
         syntax => syntax.TypeParameterList,
         (parentSyntax, childSyntax) => parentSyntax.WithTypeParameterList(childSyntax),
         syntax => syntax.ConstraintClauses,
         (parentSyntax, childSyntax) => parentSyntax.WithConstraintClauses(childSyntax));
     implementedInterfaces = new FilteredList <InterfaceReferenceWithCodeAnalysis>(
         baseTypes,
         @interface => Regex.IsMatch(@interface.Name, "^I[A-Z]"));
     indexers   = new InternalClassIndexerCollectionWithCodeAnalysis <TClass>(this);
     interfaces = new ClassMemberListWrapper <TClass, ClassNestedInterfaceWithCodeAnalysis, InterfaceDeclarationSyntax>(
         node,
         () => new ClassNestedInterfaceWithCodeAnalysis());
     methods           = new InternalClassMethodCollectionWithCodeAnalysis <TClass>(this);
     operatorOverloads = new ClassMemberListWrapper <TClass, ClassOperatorOverloadWithCodeAnalysis, OperatorDeclarationSyntax>(
         node,
         () => new ClassOperatorOverloadWithCodeAnalysis());
     properties        = new InternalClassPropertyCollectionWithCodeAnalysis <TClass>(this);
     staticConstructor = new ClassMemberListWrapper <TClass, ClassStaticConstructorWithCodeAnalysis, ConstructorDeclarationSyntax>(
         node,
         () => new ClassStaticConstructorWithCodeAnalysis(),
         syntax => syntax.IsStatic());
     structs = new InternalClassNestedStructCollectionWithCodeAnalysis <TClass>(this);
     members = new ClassMemberList <TClass>(node, (parentSyntax, childSyntax) => parentSyntax.WithMembers(childSyntax))
     {
         { nameof(fields.Constants), () => fields.Constants.Select(item => item.Syntax) },
         { nameof(fields.Fields), () => fields.Fields.Select(item => item.Syntax) },
         { nameof(Enums), () => enums.Select(item => item.Syntax) },
         { nameof(Delegates), () => delegates.Select(item => item.Syntax) },
         { nameof(events.Events), () => events.Events.Select(item => item.Syntax) },
         { nameof(events.EventProperties), () => events.EventProperties.Select(item => item.Syntax) },
         { nameof(events.ExplicitInterfaceEvents), () => events.ExplicitInterfaceEvents.Select(item => item.Syntax) },
         { nameof(StaticConstructor), () => staticConstructor.Select(item => item.Syntax) },
         { nameof(Constructors), () => constructors.Select(item => item.Syntax) },
         { nameof(properties.Properties), () => properties.Properties.Select(item => item.Syntax) },
         { nameof(properties.ExplicitInterfaceProperties), () => properties.ExplicitInterfaceProperties.Select(item => item.Syntax) },
         { nameof(indexers.Indexers), () => indexers.Indexers.Select(item => item.Syntax) },
         { nameof(indexers.ExplicitInterfaceIndexers), () => indexers.ExplicitInterfaceIndexers.Select(item => item.Syntax) },
         { nameof(methods.Methods), () => methods.Methods.Select(item => item.Syntax) },
         { nameof(methods.ExplicitInterfaceMethods), () => methods.ExplicitInterfaceMethods.Select(item => item.Syntax) },
         { nameof(OperatorOverloads), () => operatorOverloads.Select(item => item.Syntax) },
         { nameof(ConversionOperators), () => conversionOperators.Select(item => item.Syntax) },
         { nameof(classes.Classes), () => classes.Classes.Select(item => item.Syntax) },
         { nameof(classes.AbstractClasses), () => classes.AbstractClasses.Select(item => item.Syntax) },
         { nameof(classes.SealedClasses), () => classes.SealedClasses.Select(item => item.Syntax) },
         { nameof(classes.StaticClasses), () => classes.StaticClasses.Select(item => item.Syntax) },
         { nameof(Interfaces), () => interfaces.Select(item => item.Syntax) }
     };
 }