@@ -882,20 +882,24 @@ private predicate hasChild(ItemNode parent, ItemNode child) { child.getImmediate
882882private predicate rootHasCratePathTc ( ItemNode i1 , ItemNode i2 ) =
883883 doublyBoundedFastTC( hasChild / 2 , isRoot / 1 , hasCratePath / 1 ) ( i1 , i2 )
884884
885+ pragma [ nomagic]
886+ private predicate unqualifiedPathLookup1 ( RelevantPath p , string name , Namespace ns , ItemNode encl ) {
887+ unqualifiedPathLookup ( p , name , ns , encl )
888+ or
889+ // For `($)crate`, jump directly to the root module
890+ exists ( ItemNode i | p .isCratePath ( name , i ) |
891+ encl .( ModuleLikeNode ) .isRoot ( ) and
892+ encl = i
893+ or
894+ rootHasCratePathTc ( encl , i )
895+ )
896+ }
897+
885898pragma [ nomagic]
886899private ItemNode unqualifiedPathLookup ( RelevantPath path , Namespace ns ) {
887900 exists ( ItemNode encl , string name |
888- result = getASuccessor ( encl , pragma [ only_bind_into ] ( name ) , ns )
889- |
890- unqualifiedPathLookup ( path , name , ns , encl )
891- or
892- // For `($)crate`, jump directly to the root module
893- exists ( ItemNode i | path .isCratePath ( pragma [ only_bind_into ] ( name ) , i ) |
894- encl .( ModuleLikeNode ) .isRoot ( ) and
895- encl = i
896- or
897- rootHasCratePathTc ( encl , i )
898- )
901+ result = getASuccessor ( encl , name , ns ) and
902+ unqualifiedPathLookup1 ( path , name , ns , encl )
899903 )
900904}
901905
@@ -916,8 +920,7 @@ private ItemNode resolvePath0(RelevantPath path, Namespace ns) {
916920 or
917921 exists ( ItemNode q , string name |
918922 q = resolvePathQualifier ( path , name ) and
919- result = q .getASuccessor ( name ) and
920- ns = result .getNamespace ( )
923+ result = getASuccessor ( q , name , ns )
921924 )
922925 or
923926 result = resolveUseTreeListItem ( _, _, path ) and
0 commit comments