Skip to content

Commit ee4104b

Browse files
committed
PS: Fix parent-child mapping for iterator pipeline access synthesis.
1 parent a6a1734 commit ee4104b

File tree

1 file changed

+12
-0
lines changed
  • powershell/ql/lib/semmle/code/powershell/ast/internal

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,18 @@ private module IteratorAccessSynth {
710710
}
711711

712712
private class IteratorAccessSynth extends Synthesis {
713+
final override predicate isRelevant(Raw::Ast a) {
714+
exists(Raw::ProcessBlock pb, Raw::VarAccess va |
715+
va = a and
716+
pb = va.getParent+()
717+
|
718+
va.getUserPath() = "_"
719+
or
720+
va.getUserPath().toLowerCase() =
721+
pb.getScriptBlock().getParamBlock().getPipelineParameter().getName().toLowerCase()
722+
)
723+
}
724+
713725
private predicate expr(Raw::Ast rawParent, ChildIndex i, Raw::VarAccess va, Child child) {
714726
rawParent.getChild(toRawChildIndex(i)) = va and
715727
child = SynthChild(VarAccessSynthKind(this.varAccess(va)))

0 commit comments

Comments
 (0)