@@ -574,16 +574,16 @@ predicate globalVariableNestedFieldJumpStep(Node nodeFrom, Node nodeTo) {
574574 ) and
575575 write .getAttributeName ( ) = read .getAttributeName ( ) and
576576 nodeFrom = write .getValue ( ) and
577- nodeTo = read and
578- write .getEnclosingCallable ( ) != read .getEnclosingCallable ( )
577+ nodeTo = read // and
578+ // write.getEnclosingCallable() != read.getEnclosingCallable()
579579 )
580580}
581581
582582/**
583583 * Maximum depth for global variable nested attribute access.
584584 * Depth 0 = globalVar.foo, depth 1 = globalVar.foo.bar, depth 2 = globalVar.foo.bar.baz, etc.
585585 */
586- private int getMaxGlobalVariableDepth ( ) { result = 1 }
586+ private int getMaxGlobalVariableDepth ( ) { result = 10 }
587587
588588/**
589589 * Holds if `node` is an attribute access path starting from global variable `globalVar`.
@@ -592,7 +592,7 @@ private int getMaxGlobalVariableDepth() { result = 1 }
592592predicate globalVariableAttrPath ( ModuleVariableNode globalVar , string accessPath , Node node ) {
593593 exists ( int depth |
594594 globalVariableAttrPathAtDepth ( globalVar , accessPath , node , depth ) and
595- depth > 0
595+ depth >= 0
596596 )
597597}
598598
@@ -607,14 +607,15 @@ predicate globalVariableAttrPathAtDepth(
607607 node in [ globalVar .getARead ( ) , globalVar .getAWrite ( ) ] and
608608 accessPath = ""
609609 or
610- // Recursive case: Nested attribute access (depth > 0)
611- exists ( AttrRef attr , Node n , string attrName , int parentDepth , string parentAccessPath |
612- attr .accesses ( n , attrName ) and
613- globalVariableAttrPathAtDepth ( globalVar , parentAccessPath , n , parentDepth ) and
614- node = attr and
610+ exists ( Node obj , string attrName , string parentAccessPath , int parentDepth |
611+ node .( AttrRead ) .accesses ( obj , attrName )
612+ or
613+ exists ( AttrWrite aw | aw .accesses ( obj , attrName ) and aw .getValue ( ) = node )
614+ |
615+ globalVariableAttrPathAtDepth ( globalVar , parentAccessPath , obj , parentDepth ) and
616+ accessPath = parentAccessPath + "." + attrName and
615617 depth = parentDepth + 1 and
616- depth <= getMaxGlobalVariableDepth ( ) and
617- accessPath = parentAccessPath + "." + attrName
618+ depth <= getMaxGlobalVariableDepth ( )
618619 )
619620}
620621
0 commit comments