mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Python points-to: Fix analysis of zero-arg super().
This commit is contained in:
@@ -164,6 +164,10 @@ class SelfInstanceInternal extends TSelfInstance, ObjectInternal {
|
||||
this = TSelfInstance(_, _, result)
|
||||
}
|
||||
|
||||
ParameterDefinition getParameter() {
|
||||
this = TSelfInstance(result, _, _)
|
||||
}
|
||||
|
||||
override Builtin getBuiltin() {
|
||||
none()
|
||||
}
|
||||
|
||||
@@ -220,8 +220,8 @@ private predicate super_noargs(CallNode instantiation, ObjectInternal self, Clas
|
||||
instantiation.getScope() = func and
|
||||
/* Implicit class argument is lexically enclosing scope */
|
||||
func.getScope() = startclass.(PythonClassObjectInternal).getScope() and
|
||||
/* Implicit 'self' is the 0th parameter */
|
||||
PointsToInternal::pointsTo(func.getArg(0).asName().getAFlowNode(), context, self, _)
|
||||
/* Implicit 'self' is the `self` parameter of the enclosing function */
|
||||
self.(SelfInstanceInternal).getParameter().getParameter() = func.getArg(0)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
| 14 | Function meth | 8 |
|
||||
| 22 | Function meth | 13 |
|
||||
| 27 | Function meth | 8 |
|
||||
| 27 | Function meth | 13 |
|
||||
| 32 | Function meth | 26 |
|
||||
|
||||
Reference in New Issue
Block a user