Skip to content

Commit 9dcc424

Browse files
committed
Ruby: Include keyword parameters endpoint query
1 parent 5dcc3d4 commit 9dcc424

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ruby/ql/src/utils/modeleditor/ModelEditor.qll

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,19 @@ class Endpoint extends DataFlow::MethodNode {
6363
bindingset[this]
6464
string getParameterTypes() {
6565
// For now, return the names of postional parameters. We don't always have type information, so we can't return type names.
66-
// We don't yet handle keyword params, splat params or block params.
66+
// We don't yet handle splat params or block params.
6767
result =
6868
"(" +
69-
concat(DataFlow::ParameterNode p, int i |
70-
p = this.asCallable().getParameter(i)
69+
concat(string key, string value |
70+
value = any(int i | i.toString() = key | this.asCallable().getParameter(i)).getName()
71+
or
72+
exists(DataFlow::ParameterNode param |
73+
param = this.asCallable().getKeywordParameter(key)
74+
|
75+
value = key + ":"
76+
)
7177
|
72-
p.getName(), "," order by i
78+
value, "," order by key
7379
) + ")"
7480
}
7581

0 commit comments

Comments
 (0)