@@ -253,6 +253,11 @@ module API {
253253 /** A use of an API member at the node `nd`. */
254254 MkUse ( DataFlow:: Node nd ) { use ( _, _, nd ) }
255255
256+ private string resolveTopLevel ( ConstantReadAccess read ) {
257+ TResolved ( result ) = resolveScopeExpr ( read ) and
258+ not result .matches ( "%::%" )
259+ }
260+
256261 /**
257262 * Holds if `ref` is a use of a node that should have an incoming edge from `base` labeled
258263 * `lbl` in the API graph.
@@ -265,11 +270,10 @@ module API {
265270 lbl = Label:: member ( read .getName ( ) ) and
266271 read = access .getExpr ( )
267272 |
268- TResolved ( name ) = resolveScopeExpr ( read ) and
269- not name .matches ( "%::%" )
273+ name = resolveTopLevel ( read )
270274 or
271275 name = read .getName ( ) and
272- not exists ( resolveScopeExpr ( read ) ) and
276+ not exists ( resolveTopLevel ( read ) ) and
273277 not exists ( read .getScopeExpr ( ) )
274278 )
275279 or
@@ -288,7 +292,7 @@ module API {
288292 // lbl = `Whatever`
289293 // ref = `Rails::Whatever`
290294 exists ( ExprNodes:: ConstantAccessCfgNode c , DataFlow:: Node node , ConstantReadAccess read |
291- not exists ( resolveScopeExpr ( read ) ) and
295+ not exists ( resolveTopLevel ( read ) ) and
292296 pred .flowsTo ( node ) and
293297 node .asExpr ( ) = c .getScopeExpr ( ) and
294298 lbl = Label:: member ( read .getName ( ) ) and
0 commit comments