Skip to content

Commit b983fc6

Browse files
committed
Ruby: wip fixes
1 parent b34969d commit b983fc6

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

ruby/ql/lib/codeql/ruby/ast/internal/Synthesis.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,10 @@ private module AssignOperationDesugar {
833833
)
834834
)
835835
}
836+
837+
final override predicate excludeFromControlFlowTree(AstNode n) {
838+
n = any(ScopeResolutionAssignOperation sao).getLeftOperand()
839+
}
836840
}
837841

838842
/** An assignment operation where the left-hand side is a method call. */

ruby/ql/lib/codeql/ruby/controlflow/ControlFlowGraph2.qll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,29 @@ private module Ast implements AstSig<Location> {
8989
index = 1 and pair.getValue() = result
9090
)
9191
or
92+
exists(R::Ast::ArrayPattern arraypattern | parent = arraypattern |
93+
index = -1 and arraypattern.getClass() = result
94+
or
95+
arraypattern.getPrefixElement(index) = result
96+
or
97+
exists(int restix | restix = count(arraypattern.getPrefixElement(_)) |
98+
restix = index and arraypattern.getRestVariableAccess() = result
99+
or
100+
arraypattern.getSuffixElement(index - restix - 1) = result
101+
)
102+
)
103+
or
104+
exists(R::Ast::FindPattern findpattern | parent = findpattern |
105+
index = -2 and findpattern.getClass() = result
106+
or
107+
index = -1 and findpattern.getPrefixVariableAccess() = result
108+
or
109+
findpattern.getElement(index) = result
110+
or
111+
index = 1 + max(int i | exists(findpattern.getElement(i))) and
112+
findpattern.getSuffixVariableAccess() = result
113+
)
114+
or
92115
exists(R::Ast::HashPattern hashpattern | parent = hashpattern |
93116
index = -1 and hashpattern.getClass() = result
94117
or

0 commit comments

Comments
 (0)