@@ -752,12 +752,6 @@ module PointsTo {
752752 origin = orig .asCfgNodeOrHere ( f )
753753 |
754754 mod .getSourceModule ( ) = f .getEnclosingModule ( ) and
755- exists ( EssaVariable var |
756- var .getSourceVariable ( ) .getName ( ) = name and var .getAUse ( ) = f and
757- ssa_variable_points_to ( var , context , value , cls , orig )
758- )
759- or
760- mod .getSourceModule ( ) = f .getEnclosingModule ( ) and
761755 not exists ( EssaVariable var | var .getSourceVariable ( ) .getName ( ) = name and var .getAUse ( ) = f ) and
762756 exists ( EssaVariable dollar |
763757 isModuleStateVariable ( dollar ) and dollar .getAUse ( ) = f and
@@ -767,6 +761,20 @@ module PointsTo {
767761 not mod .getSourceModule ( ) = f .getEnclosingModule ( ) and
768762 Layer:: module_attribute_points_to ( mod , name , value , cls , orig )
769763 )
764+ or
765+ exists ( EssaVariable var , CfgOrigin orig |
766+ var = ssa_variable_for_module_attribute ( f , context ) and
767+ ssa_variable_points_to ( var , context , value , cls , orig ) and
768+ origin = orig .asCfgNodeOrHere ( f )
769+ )
770+ }
771+
772+ private EssaVariable ssa_variable_for_module_attribute ( ImportMemberNode f , PointsToContext context ) {
773+ exists ( string name , ModuleObject mod , Module m |
774+ mod .getSourceModule ( ) = m and m = f .getEnclosingModule ( ) and m = result .getScope ( ) and
775+ points_to ( f .getModule ( name ) , context , mod , _, _) and
776+ result .getSourceVariable ( ) .getName ( ) = name and result .getAUse ( ) = f
777+ )
770778 }
771779
772780 /** Holds if `f` is of the form `getattr(x, "name")` and x.name points to `(value, cls, origin)`. */
0 commit comments