Python points-to: Fix analysis of zero-arg super().

This commit is contained in:
Mark Shannon
2019-05-13 12:00:38 +01:00
parent d74c76510f
commit 2905737a0e
3 changed files with 6 additions and 3 deletions

View File

@@ -164,6 +164,10 @@ class SelfInstanceInternal extends TSelfInstance, ObjectInternal {
this = TSelfInstance(_, _, result)
}
ParameterDefinition getParameter() {
this = TSelfInstance(result, _, _)
}
override Builtin getBuiltin() {
none()
}

View File

@@ -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)
)
}

View File

@@ -2,5 +2,4 @@
| 14 | Function meth | 8 |
| 22 | Function meth | 13 |
| 27 | Function meth | 8 |
| 27 | Function meth | 13 |
| 32 | Function meth | 26 |