Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/System.Management.Automation/engine/parser/AstVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ internal class AstSearcher : AstVisitor2
{
#region External interface

internal static IEnumerable<Ast> FindAll(Ast ast, Func<Ast, bool> predicate, bool searchNestedScriptBlocks)
internal static List<Ast> FindAll(Ast ast, Func<Ast, bool> predicate, bool searchNestedScriptBlocks)
Comment thread
daxian-dbw marked this conversation as resolved.
Resolved
{
Diagnostics.Assert(ast != null && predicate != null, "caller to verify arguments");

Expand All @@ -432,6 +432,21 @@ internal static bool Contains(Ast ast, Func<Ast, bool> predicate, bool searchNes
return searcher.Results.Count > 0;
}

internal static bool AnyContains(IReadOnlyList<Ast> asts, Func<Ast, bool> predicate, bool searchNestedScriptBlocks)
{
Diagnostics.Assert(asts != null && predicate != null, "caller to verify arguments");

for (int index = 0; index < asts.Count; index++)
{
if (Contains(asts[index], predicate, searchNestedScriptBlocks))
{
return true;
}
}

return false;
}

internal static bool IsUsingDollarInput(Ast ast)
{
return (AstSearcher.Contains(
Expand Down
Loading