mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
Merge pull request #4384 from tausbn/python-fix-package-locations
Python: Fix `hasLocationInfo` for packages
This commit is contained in:
@@ -415,6 +415,12 @@ class Location extends @location {
|
||||
locations_ast(this, m, startline, startcolumn, endline, endcolumn)
|
||||
)
|
||||
)
|
||||
or
|
||||
// Packages have no suitable filepath, so we use just the path instead.
|
||||
exists(Module m | not exists(m.getFile()) |
|
||||
filepath = m.getPath().getAbsolutePath() and
|
||||
locations_ast(this, m, startline, startcolumn, endline, endcolumn)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| nested/__init__.py:1:6:1:12 | ControlFlowNode for ImportExpr | import | nested/nested.py:0:0:0:0 | Module nested.nested |
|
||||
| nested/nested.py:1:1:1:13 | ControlFlowNode for FunctionExpr | import | nested/nested.py:1:1:1:13 | Function nested |
|
||||
| test.py:1:6:1:11 | ControlFlowNode for ImportExpr | import | file://:0:0:0:0 | Package nested |
|
||||
| test.py:1:6:1:11 | ControlFlowNode for ImportExpr | import | nested:0:0:0:0 | Package nested |
|
||||
| test.py:2:1:2:6 | ControlFlowNode for nested | import | nested/nested.py:1:1:1:13 | Function nested |
|
||||
|
||||
Reference in New Issue
Block a user