コード例 #1
0
 public WrappedChildSyntaxList(
     IChildSyntaxList <TParentSyntax, TChildSyntax> list,
     IWrappedListConversions <TChildSyntax, TChildChildSyntax> conversions,
     Func <TChildChildSyntax, bool> filter = null)
     : this(list, conversions.ToChild, conversions.ToParent, filter)
 {
 }
コード例 #2
0
 public BaseTypeSyntaxListConversions(
     Node <TParent, TParentSyntax> node,
     Func <TParentSyntax, BaseListSyntax, TParentSyntax> createList)
 {
     this.createList = createList;
     list            = ListFactory.CreateChildSyntaxList(node, this);
 }
コード例 #3
0
 public ChildNodeList(
     Node <TParent, TParentSyntax> node,
     IChildSyntaxList <TParentSyntax, TChildSyntax> list,
     Func <TChildSyntax, TChild> factory)
     : this(node, list)
 {
     this.factory = index => factory(this.list[index]);
 }
コード例 #4
0
 private ChildNodeList(
     Node <TParent, TParentSyntax> node,
     IChildSyntaxList <TParentSyntax, TChildSyntax> list)
 {
     node.ChildNodes.Add(this);
     this.node = node;
     this.list = list;
     innerList = new List <TChild>();
 }
コード例 #5
0
 public WrappedChildSyntaxList(
     IChildSyntaxList <TParentSyntax, TChildSyntax> list,
     Func <TChildSyntax, TChildChildSyntax> toChild,
     Func <TChildChildSyntax, TChildSyntax> toParent,
     Func <TChildChildSyntax, bool> filter = null)
     : base(list, toChild, toParent, filter)
 {
     this.list     = list;
     this.toParent = toParent;
 }
コード例 #6
0
 public FilteredChildSyntaxList(
     IChildSyntaxList <TParentSyntax, TChildBaseSyntax> list,
     Func <TChildSyntax, bool> filter = null)
     : base(list, parent => parent as TChildSyntax, child => child, filter)
 {
 }
        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)));
        }