public static IEnumerable <SyntaxNode> Enumerate(this PatternNode self, IEnumerable <SyntaxNode> nodes, SemanticModel semanticModel = null)
        {
            if (self == null)
            {
                throw new ArgumentNullException(nameof(self));
            }
            if (nodes == null)
            {
                throw new ArgumentNullException(nameof(nodes));
            }

            foreach (var node in nodes)
            {
                if (self.IsMatch(node, semanticModel))
                {
                    yield return(node);
                }
            }
        }
 internal AnyLambdaExpressionPattern(PatternNode body, ParameterListPattern parameterList, Action <LambdaExpressionSyntax> action)
     : base(body)
 {
     _parameterList = parameterList;
     _action        = action;
 }
예제 #3
0
 public static AnyLambdaExpressionPattern AnyLambdaExpression(PatternNode body = null, ParameterListPattern parameterList = null, Action <LambdaExpressionSyntax> action = null)
 {
     return(new AnyLambdaExpressionPattern(body, parameterList, action));
 }
 public static IList <SyntaxNode> MatchDescendantNodesAndSelf(this PatternNode self, SyntaxNode node, TextSpan span, Func <SyntaxNode, bool> descendIntoChildren = null, bool descendIntoTrivia = false, SemanticModel semanticModel = null)
 {
     return(self.EnumerateDescendantNodesAndSelf(node, span, descendIntoChildren, descendIntoTrivia, semanticModel).ToList());
 }
 public static IEnumerable <SyntaxNode> EnumerateDescendantNodesAndSelf(this PatternNode self, SyntaxNode node, Func <SyntaxNode, bool> descendIntoChildren = null, bool descendIntoTrivia = false, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(node.DescendantNodesAndSelf(descendIntoChildren, descendIntoTrivia), semanticModel));
 }
 public static IEnumerable <SyntaxNode> EnumerateChildNodes(this PatternNode self, SyntaxNode node, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(node.ChildNodes(), semanticModel));
 }
 public static IList <SyntaxNode> MatchChildNodes(this PatternNode self, SyntaxNode node, SemanticModel semanticModel = null)
 {
     return(self.EnumerateChildNodes(node, semanticModel).ToList());
 }
 public static IEnumerable <SyntaxNode> EnumerateAncestorsAndSelf(this PatternNode self, SyntaxNode node, bool ascendOutOfTrivia = true, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(node.AncestorsAndSelf(ascendOutOfTrivia), semanticModel));
 }
 public static IList <SyntaxNode> MatchAncestorsAndSelf(this PatternNode self, SyntaxNode node, bool ascendOutOfTrivia = true, SemanticModel semanticModel = null)
 {
     return(self.EnumerateAncestorsAndSelf(node, ascendOutOfTrivia, semanticModel).ToList());
 }
 public static IEnumerable <SyntaxNode> EnumerateGetAnnotatedNodes(this PatternNode self, SyntaxNode node, SyntaxAnnotation syntaxAnnotation, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(node.GetAnnotatedNodes(syntaxAnnotation), semanticModel));
 }
 public static IList <SyntaxNode> MatchGetAnnotatedNodes(this PatternNode self, SyntaxNode node, SyntaxAnnotation syntaxAnnotation, SemanticModel semanticModel = null)
 {
     return(self.EnumerateGetAnnotatedNodes(node, syntaxAnnotation, semanticModel).ToList());
 }
 public static IEnumerable <SyntaxNode> EnumerateGetAnnotatedNodes(this PatternNode self, SyntaxNode node, string annotationKind, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(node.GetAnnotatedNodes(annotationKind), semanticModel));
 }
 public static IList <SyntaxNode> Match(this PatternNode self, IEnumerable <SyntaxNode> nodes, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(nodes, semanticModel).ToList());
 }