Skip to content

Commit 6a7c1e9

Browse files
committed
PS: Ensure that variables whose only assignment is behind a conversion also generate AST variables.
1 parent 294af54 commit 6a7c1e9

File tree

1 file changed

+13
-1
lines changed
  • powershell/ql/lib/semmle/code/powershell/ast/internal

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,22 @@ module Private {
140140
predicate explicitAssignment(Raw::Ast dest, Raw::Ast assignment) {
141141
assignment.(Raw::AssignStmt).getLeftHandSide() = dest
142142
or
143+
exists(Raw::ConvertExpr convert |
144+
convert.getExpr() = dest and
145+
explicitAssignment(convert, assignment)
146+
)
147+
or
143148
any(Synthesis s).explicitAssignment(dest, _, assignment)
144149
}
145150

146-
predicate implicitAssignment(Raw::Ast n) { any(Synthesis s).implicitAssignment(n, _) }
151+
predicate implicitAssignment(Raw::Ast n) {
152+
any(Synthesis s).implicitAssignment(n, _)
153+
or
154+
exists(Raw::ConvertExpr convert |
155+
convert.getExpr() = n and
156+
implicitAssignment(convert)
157+
)
158+
}
147159
}
148160

149161
private import Private

0 commit comments

Comments
 (0)