Python: Fix unwanted module type tracking

This commit is contained in:
Taus Brock-Nannestad
2020-10-13 22:47:57 +02:00
parent 76e5b59dab
commit 7d86b53b71
2 changed files with 1 additions and 8 deletions

View File

@@ -70,7 +70,7 @@ Node importModule(string name) {
// Because named imports are modelled as `AttrRead`s, the statement `from foo import bar as baz`
// is interpreted as if it was an assignment `baz = foo.bar`, which means `baz` gets tracked as a
// reference to `foo.bar`, as desired.
result.asCfgNode().getNode() = any(ImportExpr i | i.getAnImportedModuleName() = name)
result.asCfgNode().getNode() = any(ImportExpr i | i.getName() = name)
}
/**

View File

@@ -1,12 +1,5 @@
module_tracker
| import_as_attr.py:1:6:1:11 | ControlFlowNode for ImportExpr |
| import_as_attr_dotted.py:0:0:0:0 | ModuleVariableNode for Global Variable attr_ref in Module import_as_attr_dotted |
| import_as_attr_dotted.py:1:8:1:18 | ControlFlowNode for ImportExpr |
| import_as_attr_dotted.py:1:23:1:30 | GSSA Variable attr_ref |
| import_as_attr_dotted.py:3:1:3:1 | GSSA Variable x |
| import_as_attr_dotted.py:3:5:3:12 | ControlFlowNode for attr_ref |
| import_as_attr_dotted.py:6:5:6:5 | SSA variable y |
| import_as_attr_dotted.py:6:9:6:16 | ControlFlowNode for attr_ref |
module_attr_tracker
| import_as_attr.py:0:0:0:0 | ModuleVariableNode for Global Variable attr_ref in Module import_as_attr |
| import_as_attr.py:1:20:1:35 | ControlFlowNode for ImportMember |