@@ -2063,6 +2063,16 @@ module PointsTo {
20632063 )
20642064 }
20652065
2066+ /** Maps the caller object/context to callee parameter/context for self in calls to methods */
2067+ private predicate self_in_method_call ( ControlFlowNode obj , PointsToContext caller , ParameterDefinition self , PointsToContext callee ) {
2068+ self .isSelf ( ) and
2069+ exists ( FunctionObject meth , CallNode call |
2070+ meth .getFunction ( ) = self .getScope ( ) and
2071+ callee .fromCall ( call , meth , caller ) and
2072+ call .getFunction ( ) .( AttrNode ) .getObject ( ) = obj
2073+ )
2074+ }
2075+
20662076 pragma [ noinline]
20672077 private predicate self_parameter_named_attribute_points_to ( ParameterDefinition def , PointsToContext context , string name , Object value , ClassObject vcls , ControlFlowNode origin ) {
20682078 exists ( CfgOrigin orig |
@@ -2071,11 +2081,8 @@ module PointsTo {
20712081 context .isRuntime ( ) and executes_in_runtime_context ( def .getScope ( ) ) and
20722082 ssa_variable_named_attribute_points_to ( preceding_self_variable ( def ) , context , name , value , vcls , orig )
20732083 or
2074- exists ( FunctionObject meth , CallNode call , PointsToContext caller_context , ControlFlowNode obj |
2075- meth .getFunction ( ) = def .getScope ( ) and
2076- method_call ( meth , caller_context , call ) and
2077- call .getFunction ( ) .( AttrNode ) .getObject ( ) = obj and
2078- context .fromCall ( call , meth , caller_context ) and
2084+ exists ( PointsToContext caller_context , ControlFlowNode obj |
2085+ self_in_method_call ( obj , caller_context , def , context ) and
20792086 named_attribute_points_to ( obj , caller_context , name , value , vcls , orig )
20802087 )
20812088 )
0 commit comments