/// <summary> /// Find the first match of a given snippet in a tree. /// </summary> /// <param name="haystack">A <see cref="SyntaxNode"/> representing the code to be searched in.</param> /// <param name="needle">A match pattern.</param> /// <returns></returns> public static IEnumerable <SyntaxNode> Matches(SyntaxNode haystack, Snippet needle) { return(Matches(haystack, needle.Expression)); }
/// <summary> /// Find the first match of a given snippet in a tree. /// </summary> /// <param name="haystack">A <see cref="SyntaxNode"/> representing the code to be searched in.</param> /// <param name="needle">A match pattern.</param> /// <returns></returns> public static SyntaxNode?Match(SyntaxNode haystack, Snippet needle) { return(Matches(haystack, needle.Expression).FirstOrDefault()); }