Skip to content

Commit e882cda

Browse files
committed
Ruby: Add missing getCallable() for nested destructured parameters
1 parent 10b2a0a commit e882cda

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ruby/ql/lib/codeql/ruby/ast/Parameter.qll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ private import internal.TreeSitter
77
/** A parameter. */
88
class Parameter extends AstNode, TParameter {
99
/** Gets the callable that this parameter belongs to. */
10-
final Callable getCallable() { result.getAParameter() = this }
10+
final Callable getCallable() {
11+
result.getAParameter() = this
12+
or
13+
exists(DestructuredParameter parent |
14+
this = parent.getAnElement() and
15+
result = parent.getCallable()
16+
)
17+
}
1118

1219
/** Gets the zero-based position of this parameter. */
1320
final int getPosition() { this = any(Callable c).getParameter(result) }

0 commit comments

Comments
 (0)