@@ -17,33 +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
38- not toKind = fromKind and
3940
4041 // exceptions
4142 not (
4243 // the class has a second member with the same name and the right kind
43- exists ( MethodDefinition toMethodWithSameKind |
44- isLocalMethodAccess ( access , fromMethod , toMethodWithSameKind ) and
45- fromKind = getKind ( toMethodWithSameKind )
46- )
44+ isLocalMethodAccess ( access , fromMethod , _, _, fromKind )
4745 or
4846 // there is a dynamically assigned second member with the same name and the right kind
4947 exists ( AnalyzedPropertyWrite apw , AbstractClass declaringClass , AbstractValue base |
0 commit comments