public AttributeListWrapper( Node <TParent, TParentSyntax> node, Func <TParentSyntax, SyntaxList <AttributeListSyntax> > getList, Func <TParentSyntax, SyntaxList <AttributeListSyntax>, TParentSyntax> createList) : base(node, getList, createList, () => new AttributeGroupWithCodeAnalysis()) { this.node = node; this.createList = createList; attributes = new FilteredAttributeList(this, attribute => attribute.Syntax.Target == null); targetedAttributes = new FilteredAttributeList(this, attribute => attribute.Syntax.Target != null); }
internal LoadedDocumentWithCodeAnalysis(DocumentWithCodeAnalysis document, CompilationUnitSyntax syntax) { this.document = document; node = new Node <LoadedDocumentWithCodeAnalysis, CompilationUnitSyntax>(this, syntax); attributes = new AttributeListWrapper <LoadedDocumentWithCodeAnalysis, CompilationUnitSyntax>( node, parentSyntax => parentSyntax.AttributeLists, (parentSyntax, childSyntax) => parentSyntax.WithAttributeLists(childSyntax)); assemblyAttributes = new FilteredAttributeList(attributes, attribute => attribute.Syntax.Target.Identifier.Text == "assembly"); classes = new ClassCollectionWithCodeAnalysis(this); delegates = new LoadedDocumentMemberListWrapper <DelegateWithCodeAnalysis, DelegateDeclarationSyntax>( node, () => new DelegateWithCodeAnalysis(document)); enums = new LoadedDocumentMemberListWrapper <EnumWithCodeAnalysis, EnumDeclarationSyntax>( node, () => new EnumWithCodeAnalysis(document)); interfaces = new LoadedDocumentMemberListWrapper <InterfaceWithCodeAnalysis, InterfaceDeclarationSyntax>( node, () => new InterfaceWithCodeAnalysis(document)); moduleAttributes = new FilteredAttributeList(attributes, attribute => attribute.Syntax.Target.Identifier.Text == "module"); namespaces = new LoadedDocumentMemberListWrapper <NamespaceWithCodeAnalysis, NamespaceDeclarationSyntax>( node, () => new NamespaceWithCodeAnalysis(document)); structs = new StructCollectionWithCodeAnalysis(this); usingDirectives = new SyntaxNodeList <LoadedDocumentWithCodeAnalysis, CompilationUnitSyntax, UsingDirectiveWithCodeAnalysis, UsingDirectiveSyntax>( node, currentSyntax => currentSyntax.Usings, (parentSyntax, childSyntax) => parentSyntax.WithUsings(childSyntax), () => new UsingDirectiveWithCodeAnalysis()); members = new MemberList <LoadedDocumentWithCodeAnalysis, CompilationUnitSyntax>( node, (parentSyntax, childSyntax) => parentSyntax.WithMembers(childSyntax)) { { 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(Delegates), () => delegates.Select(item => item.Syntax) }, { nameof(Enums), () => enums.Select(item => item.Syntax) }, { nameof(Interfaces), () => interfaces.Select(item => item.Syntax) }, { nameof(Namespaces), () => namespaces.Select(item => item.Syntax) }, { nameof(structs.Structs), () => structs.Structs.Select(item => item.Syntax) } }; }