Exemplo n.º 1
0
 public BaseTypeSyntaxListConversions(
     Node <TParent, TParentSyntax> node,
     Func <TParentSyntax, BaseListSyntax, TParentSyntax> createList)
 {
     this.createList = createList;
     list            = ListFactory.CreateChildSyntaxList(node, this);
 }
        private static IList <TChild> CreateConstraintList <TChild>(
            Node <GenericParameterDeclarationWithCodeAnalysis, GenericParameterDeclarationSyntax> node,
            Func <string, bool> filter,
            Func <UnspecifiedTypeReferenceWithCodeAnalysis, TChild> getChild)
            where TChild : class, IHasNode <TypeSyntax>, IUnspecifiedTypeReferenceWrapper
        {
            IChildSyntaxList <GenericParameterDeclarationSyntax, TypeParameterConstraintSyntax> constraintSyntaxList =
                ListFactory.CreateChildSyntaxList(
                    node,
                    syntax => syntax.Constraints,
                    (parentSyntax, childSyntax) => parentSyntax.WithConstraints(childSyntax));
            IChildSyntaxList <GenericParameterDeclarationSyntax, TypeConstraintSyntax> filteredConstraintSyntaxList =
                new FilteredChildSyntaxList <GenericParameterDeclarationSyntax, TypeParameterConstraintSyntax, TypeConstraintSyntax>(
                    constraintSyntaxList,
                    syntax => filter(syntax.Type.ToName()));
            IList <GenericParameterConstraint> constraintList = new ChildNodeList <
                GenericParameterDeclarationWithCodeAnalysis,
                GenericParameterDeclarationSyntax,
                GenericParameterConstraint,
                TypeConstraintSyntax>(
                node,
                filteredConstraintSyntaxList,
                () => new GenericParameterConstraint());

            return(new WrappedList <GenericParameterConstraint, TChild>(
                       constraintList,
                       parent => getChild(parent.Type),
                       child => child.Node.GetParent <GenericParameterConstraint>() ?? new GenericParameterConstraint(child.TypeReference)));
        }
Exemplo n.º 3
0
 public SeparatedSyntaxNodeList(
     Node <TParent, TParentSyntax> node,
     Func <TParentSyntax, SeparatedSyntaxList <TChildSyntax> > getList,
     Func <TParentSyntax, SeparatedSyntaxList <TChildSyntax>, TParentSyntax> createList,
     Func <TChild> factory)
     : base(node, ListFactory.CreateChildSyntaxList(node, getList, createList), factory)
 {
     this.node       = node;
     this.createList = createList;
 }
 public GenericParameterDeclarationSyntaxList(
     Node <TParent, TParentSyntax> node,
     TypeParameterSyntaxListConversions <TParentSyntax> typeParameterConversions,
     Func <TParentSyntax, SyntaxList <TypeParameterConstraintClauseSyntax> > getConstraintClauses,
     Func <TParentSyntax, SyntaxList <TypeParameterConstraintClauseSyntax>, TParentSyntax> createConstraintClauses)
 {
     this.node         = node;
     typeParameters    = ListFactory.CreateChildSyntaxList(node, typeParameterConversions);
     constraintClauses = ListFactory.CreateChildSyntaxList(node, getConstraintClauses, createConstraintClauses);
 }
Exemplo n.º 5
0
 private GenericParameterDeclarationNodeList(
     Node <TParent, TParentSyntax> node,
     TypeParameterSyntaxListConversions <TParentSyntax> typeParameterConversions,
     Func <TParentSyntax, SyntaxList <TypeParameterConstraintClauseSyntax> > getConstraintClauses,
     Func <TParentSyntax, SyntaxList <TypeParameterConstraintClauseSyntax>, TParentSyntax> createConstraintClauses)
     : base(
         node,
         ListFactory.CreateChildSyntaxList(node, typeParameterConversions, getConstraintClauses, createConstraintClauses),
         () => new GenericParameterDeclarationWithCodeAnalysis())
 {
 }