Skip to content

Commit 6084789

Browse files
committed
PS: Fix the top level arguments after the AST cleanup.
1 parent 793fd5e commit 6084789

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

powershell/ql/lib/semmle/code/powershell/ast/internal/FunctionBase.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ class FunctionBase extends Ast, TFunctionBase {
2121

2222
final int getNumberOfParameters() { result = count(this.getAParameter()) }
2323
}
24+
25+
/**
26+
* The implicit function that represents the entire script block in a file.
27+
*/
28+
class TopLevelFunction extends FunctionBase, TTopLevelFunction { }

powershell/ql/lib/semmle/code/powershell/dataflow/flowsources/Local.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private class ExternalCommandLineArgumentSource extends CommandLineArgumentSourc
5959
* A data flow source that represents the parameters of the `Main` method of a program.
6060
*/
6161
private class MainMethodArgumentSource extends CommandLineArgumentSource {
62-
MainMethodArgumentSource() { this.asParameter().getParent() instanceof TopLevelScriptBlock }
62+
MainMethodArgumentSource() { this.asParameter().getFunction() instanceof TopLevelFunction }
6363
}
6464

6565
/**

0 commit comments

Comments
 (0)