mirror of
https://github.com/github/codeql.git
synced 2025-12-21 11:16:30 +01:00
Python: Also capture alias with new name
This commit is contained in:
@@ -190,11 +190,12 @@ module NotExposed {
|
||||
string relevantName, Location loc
|
||||
) {
|
||||
loc = mod.getLocation() and
|
||||
exists(API::Node relevantClass, ClassExpr classExpr |
|
||||
exists(API::Node relevantClass, Expr value |
|
||||
relevantClass = newOrExistingModeling(spec).getASubclass*() and
|
||||
ImportResolution::module_export(mod, relevantName, def) and
|
||||
classExpr = relevantClass.asSource().asExpr() and
|
||||
classExpr = def.asVar().getDefinition().(AssignmentDefinition).getValue().getNode()
|
||||
value = relevantClass.getAValueReachableFromSource().asExpr() and
|
||||
value = def.asVar().getDefinition().(AssignmentDefinition).getValue().getNode()
|
||||
// value could be a ClassExpr if a new class is defined, or a Name if defining an alias
|
||||
) and
|
||||
(
|
||||
mod.isPackageInit() and
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
| flask.View~Subclass | find_subclass_test | Member[A] |
|
||||
| flask.View~Subclass | find_subclass_test | Member[B] |
|
||||
| flask.View~Subclass | find_subclass_test | Member[ViewAlias] |
|
||||
| flask.View~Subclass | find_subclass_test | Member[View] |
|
||||
|
||||
@@ -5,3 +5,6 @@ class A(View):
|
||||
|
||||
class B(A):
|
||||
pass
|
||||
|
||||
|
||||
ViewAlias = View
|
||||
|
||||
Reference in New Issue
Block a user