コード例 #1
0
        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
ファイル: Pattern.cs プロジェクト: andrzejolszak/code-cracker
 public static AnyLambdaExpressionPattern AnyLambdaExpression(PatternNode body = null, ParameterListPattern parameterList = null, Action <LambdaExpressionSyntax> action = null)
 {
     return(new AnyLambdaExpressionPattern(body, parameterList, action));
 }
コード例 #4
0
 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());
 }
コード例 #5
0
 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));
 }
コード例 #6
0
 public static IEnumerable <SyntaxNode> EnumerateChildNodes(this PatternNode self, SyntaxNode node, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(node.ChildNodes(), semanticModel));
 }
コード例 #7
0
 public static IList <SyntaxNode> MatchChildNodes(this PatternNode self, SyntaxNode node, SemanticModel semanticModel = null)
 {
     return(self.EnumerateChildNodes(node, semanticModel).ToList());
 }
コード例 #8
0
 public static IEnumerable <SyntaxNode> EnumerateAncestorsAndSelf(this PatternNode self, SyntaxNode node, bool ascendOutOfTrivia = true, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(node.AncestorsAndSelf(ascendOutOfTrivia), semanticModel));
 }
コード例 #9
0
 public static IList <SyntaxNode> MatchAncestorsAndSelf(this PatternNode self, SyntaxNode node, bool ascendOutOfTrivia = true, SemanticModel semanticModel = null)
 {
     return(self.EnumerateAncestorsAndSelf(node, ascendOutOfTrivia, semanticModel).ToList());
 }
コード例 #10
0
 public static IEnumerable <SyntaxNode> EnumerateGetAnnotatedNodes(this PatternNode self, SyntaxNode node, SyntaxAnnotation syntaxAnnotation, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(node.GetAnnotatedNodes(syntaxAnnotation), semanticModel));
 }
コード例 #11
0
 public static IList <SyntaxNode> MatchGetAnnotatedNodes(this PatternNode self, SyntaxNode node, SyntaxAnnotation syntaxAnnotation, SemanticModel semanticModel = null)
 {
     return(self.EnumerateGetAnnotatedNodes(node, syntaxAnnotation, semanticModel).ToList());
 }
コード例 #12
0
 public static IEnumerable <SyntaxNode> EnumerateGetAnnotatedNodes(this PatternNode self, SyntaxNode node, string annotationKind, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(node.GetAnnotatedNodes(annotationKind), semanticModel));
 }
コード例 #13
0
 public static IList <SyntaxNode> Match(this PatternNode self, IEnumerable <SyntaxNode> nodes, SemanticModel semanticModel = null)
 {
     return(self.Enumerate(nodes, semanticModel).ToList());
 }