mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Python: CG trace: Much improved toString for QL
This commit is contained in:
@@ -30,10 +30,19 @@ class XMLRecordedCall extends XMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
result =
|
exists(string path |
|
||||||
this.getName() + ": <..>/" +
|
path =
|
||||||
this.getXMLCall().get_filename_data().regexpCapture(".*/([^/]+)$", 1) + ":" +
|
any(File file | file.getAbsolutePath() = this.getXMLCall().get_filename_data())
|
||||||
this.getXMLCall().get_linenum_data()
|
.getRelativePath()
|
||||||
|
or
|
||||||
|
not exists(File file |
|
||||||
|
file.getAbsolutePath() = this.getXMLCall().get_filename_data() and
|
||||||
|
exists(file.getRelativePath())
|
||||||
|
) and
|
||||||
|
path = this.getXMLCall().get_filename_data()
|
||||||
|
|
|
||||||
|
result = this.getName() + ": " + path + ":" + this.getXMLCall().get_linenum_data()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,10 +170,15 @@ class IdentifiedRecordedCall extends XMLRecordedCall {
|
|||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
exists(string callee_str |
|
exists(string callee_str |
|
||||||
exists(Function callee | callee = this.getPythonCallee() |
|
exists(Function callee, string path | callee = this.getPythonCallee() |
|
||||||
|
(
|
||||||
|
path = callee.getLocation().getFile().getRelativePath()
|
||||||
|
or
|
||||||
|
not exists(callee.getLocation().getFile().getRelativePath()) and
|
||||||
|
path = callee.getLocation().getFile().getAbsolutePath()
|
||||||
|
) and
|
||||||
callee_str =
|
callee_str =
|
||||||
callee.toString() + " (<..>/" + callee.getLocation().getFile().getRelativePath() + ":" +
|
callee.toString() + " (" + path + ":" + callee.getLocation().getStartLine() + ")"
|
||||||
callee.getLocation().getStartLine() + ")"
|
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
callee_str = this.getBuiltinCallee().toString()
|
callee_str = this.getBuiltinCallee().toString()
|
||||||
|
|||||||
Reference in New Issue
Block a user