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