Skip to content

Commit 76bd415

Browse files
committed
PS: Drive-by fix: '' is the same thing as ''
1 parent 8a575c4 commit 76bd415

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

powershell/ql/lib/semmle/code/powershell/Variable.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private predicate isParameterImpl(string name, Scope scope) {
4141
private newtype TParameterImpl =
4242
TInternalParameter(Internal::Parameter p) or
4343
TUnderscore(Scope scope) {
44-
exists(VarAccess va | va.getUserPath() = "_" and scope = va.getEnclosingScope())
44+
exists(VarAccess va | va.getUserPath() = ["_", "PSItem"] and scope = va.getEnclosingScope())
4545
} or
4646
TThisParameter(Scope scope) { exists(scope.getEnclosingFunction().getDeclaringType()) }
4747

@@ -87,6 +87,11 @@ private class InternalParameter extends ParameterImpl, TInternalParameter {
8787
override Expr getDefaultValue() { result = p.getDefaultValue() }
8888
}
8989

90+
/**
91+
* The variable that represents an element in the pipeline.
92+
*
93+
* This is either the variable `$_` or the variable `$PSItem`.
94+
*/
9095
private class Underscore extends ParameterImpl, TUnderscore {
9196
Scope scope;
9297

0 commit comments

Comments
 (0)