Skip to content

Commit f877f7d

Browse files
committed
Ruby: Stick to dataflow layer in endpoints query
1 parent 944fbeb commit f877f7d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ string getNamespace(File file) {
3838
)
3939
}
4040

41-
abstract class Endpoint instanceof AstNode {
42-
string getNamespace() { result = getNamespace(this.(AstNode).getLocation().getFile()) }
41+
abstract class Endpoint instanceof DataFlow::Node {
42+
string getNamespace() { result = getNamespace(super.getLocation().getFile()) }
4343

44-
string getFileName() { result = this.(AstNode).getLocation().getFile().getBaseName() }
44+
string getFileName() { result = super.getLocation().getFile().getBaseName() }
4545

46-
string toString() { result = this.(AstNode).toString() }
46+
string toString() { result = super.toString() }
4747

48-
Location getLocation() { result = this.(AstNode).getLocation() }
48+
Location getLocation() { result = super.getLocation() }
4949

5050
abstract string getType();
5151

@@ -65,7 +65,7 @@ class MethodEndpoint extends Endpoint {
6565
private DataFlow::MethodNode methodNode;
6666

6767
MethodEndpoint() {
68-
this = methodNode.asExpr().getExpr() and
68+
this = methodNode and
6969
methodNode.isPublic() and
7070
not isUninteresting(methodNode)
7171
}
@@ -197,8 +197,8 @@ class ModuleEndpoint extends Endpoint {
197197

198198
ModuleEndpoint() {
199199
this =
200-
min(AstNode n, Location loc |
201-
n = moduleNode.getADeclaration() and
200+
min(DataFlow::Node n, Location loc |
201+
n.asExpr().getExpr() = moduleNode.getADeclaration() and
202202
loc = n.getLocation()
203203
|
204204
n order by loc.getFile().getAbsolutePath(), loc.getStartLine(), loc.getStartColumn()

0 commit comments

Comments
 (0)