Skip to content

Commit 4c6855e

Browse files
committed
Ruby: Address review comments
1 parent f877f7d commit 4c6855e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,44 +62,44 @@ abstract class Endpoint instanceof DataFlow::Node {
6262
* A callable method or accessor from source code.
6363
*/
6464
class MethodEndpoint extends Endpoint {
65-
private DataFlow::MethodNode methodNode;
66-
6765
MethodEndpoint() {
68-
this = methodNode and
69-
methodNode.isPublic() and
70-
not isUninteresting(methodNode)
66+
this.(DataFlow::MethodNode).isPublic() and
67+
not isUninteresting(this)
7168
}
7269

73-
DataFlow::MethodNode getNode() { result = methodNode }
70+
DataFlow::MethodNode getNode() { result = this }
7471

75-
override string getName() { result = methodNode.getMethodName() }
72+
override string getName() { result = this.(DataFlow::MethodNode).getMethodName() }
7673

7774
/**
7875
* Gets the unbound type name of this endpoint.
7976
*/
8077
override string getType() {
8178
result =
82-
any(DataFlow::ModuleNode m | m.getOwnInstanceMethod(this.getName()) = methodNode)
83-
.getQualifiedName() or
79+
any(DataFlow::ModuleNode m | m.getOwnInstanceMethod(this.getName()) = this).getQualifiedName() or
8480
result =
85-
any(DataFlow::ModuleNode m | m.getOwnSingletonMethod(this.getName()) = methodNode)
81+
any(DataFlow::ModuleNode m | m.getOwnSingletonMethod(this.getName()) = this)
8682
.getQualifiedName() + "!"
8783
}
8884

8985
/**
9086
* Gets the parameter types of this endpoint.
9187
*/
9288
override string getParameters() {
93-
// For now, return the names of postional and keyword parameters. We don't always have type information, so we can't return type names.
89+
// For now, return the names of positional and keyword parameters. We don't always have type information, so we can't return type names.
9490
// We don't yet handle splat params or block params.
9591
result =
9692
"(" +
9793
concat(string key, string value |
9894
value =
99-
any(int i | i.toString() = key | methodNode.asCallable().getParameter(i)).getName()
95+
any(int i |
96+
i.toString() = key
97+
|
98+
this.(DataFlow::MethodNode).asCallable().getParameter(i)
99+
).getName()
100100
or
101101
exists(DataFlow::ParameterNode param |
102-
param = methodNode.asCallable().getKeywordParameter(key)
102+
param = this.(DataFlow::MethodNode).asCallable().getKeywordParameter(key)
103103
|
104104
value = key + ":"
105105
)

0 commit comments

Comments
 (0)