@@ -17,32 +17,31 @@ predicate hasMethod(ClassDefinition base, string name, MethodDefinition m) {
1717}
1818
1919/**
20- * Holds if `access` is in`fromMethod`, and it references `toMethod` through `this`.
20+ * Holds if `access` is in`fromMethod`, and it references `toMethod` through `this`,
21+ * where `fromMethod` and `toMethod` are of kind `fromKind` and `toKind`, respectively.
2122*/
22- predicate isLocalMethodAccess ( PropAccess access , MethodDefinition fromMethod , MethodDefinition toMethod ) {
23- hasMethod ( fromMethod .getDeclaringClass ( ) , access .getPropertyName ( ) , toMethod ) and
24- access .getEnclosingFunction ( ) = fromMethod .getBody ( ) and
25- access .getBase ( ) instanceof ThisExpr
23+ predicate isLocalMethodAccess ( PropAccess access , MethodDefinition fromMethod , string fromKind ,
24+ MethodDefinition toMethod , string toKind ) {
25+ hasMethod ( fromMethod .getDeclaringClass ( ) , access .getPropertyName ( ) , toMethod ) and
26+ access .getEnclosingFunction ( ) = fromMethod .getBody ( ) and
27+ access .getBase ( ) instanceof ThisExpr and
28+ fromKind = getKind ( fromMethod ) and
29+ toKind = getKind ( toMethod )
2630}
2731
2832string getKind ( MethodDefinition m ) {
29- if m .isStatic ( ) then result = "static" else result = "instance"
33+ if m .isStatic ( ) then result = "static" else result = "instance"
3034}
3135
3236from PropAccess access , MethodDefinition fromMethod , MethodDefinition toMethod , string fromKind , string toKind
3337where
34- isLocalMethodAccess ( access , fromMethod , toMethod ) and
35- fromKind = getKind ( fromMethod ) and
36- toKind = getKind ( toMethod ) and
38+ isLocalMethodAccess ( access , fromMethod , fromKind , toMethod , toKind ) and
3739 toKind != fromKind and
3840
3941 // exceptions
4042 not (
4143 // the class has a second member with the same name and the right kind
42- exists ( MethodDefinition toMethodWithSameKind |
43- isLocalMethodAccess ( access , fromMethod , toMethodWithSameKind ) and
44- fromKind = getKind ( toMethodWithSameKind )
45- )
44+ isLocalMethodAccess ( access , fromMethod , _, _, fromKind )
4645 or
4746 // there is a dynamically assigned second member with the same name and the right kind
4847 exists ( AnalyzedPropertyWrite apw , AbstractClass declaringClass , AbstractValue base |
0 commit comments