@@ -284,7 +284,7 @@ abstract class ImplOrTraitItemNode extends ItemNode {
284
284
/** Gets a `Self` path that refers to this item. */
285
285
Path getASelfPath ( ) {
286
286
isUnqualifiedSelfPath ( result ) and
287
- this = unqualifiedPathLookup ( result )
287
+ this = unqualifiedPathLookup ( result , _ )
288
288
}
289
289
290
290
/** Gets an associated item belonging to this trait or `impl` block. */
@@ -680,8 +680,8 @@ private ItemNode getASuccessor(ItemNode pred, string name, Namespace ns) {
680
680
}
681
681
682
682
pragma [ nomagic]
683
- private ItemNode unqualifiedPathLookup ( RelevantPath path ) {
684
- exists ( ItemNode encl , Namespace ns , string name |
683
+ private ItemNode unqualifiedPathLookup ( RelevantPath path , Namespace ns ) {
684
+ exists ( ItemNode encl , string name |
685
685
unqualifiedPathLookup ( path , name , ns , encl ) and
686
686
result = getASuccessor ( encl , name , ns )
687
687
)
@@ -691,9 +691,9 @@ pragma[nomagic]
691
691
private predicate isUnqualifiedSelfPath ( RelevantPath path ) { path .isUnqualified ( "Self" ) }
692
692
693
693
pragma [ nomagic]
694
- private ItemNode resolvePath0 ( RelevantPath path ) {
694
+ private ItemNode resolvePath0 ( RelevantPath path , Namespace ns ) {
695
695
exists ( ItemNode res |
696
- res = unqualifiedPathLookup ( path ) and
696
+ res = unqualifiedPathLookup ( path , ns ) and
697
697
if
698
698
not any ( RelevantPath parent ) .getQualifier ( ) = path and
699
699
isUnqualifiedSelfPath ( path ) and
@@ -704,10 +704,12 @@ private ItemNode resolvePath0(RelevantPath path) {
704
704
or
705
705
exists ( ItemNode q , string name |
706
706
q = resolvePathQualifier ( path , name ) and
707
- result = q .getASuccessor ( name )
707
+ result = q .getASuccessor ( name ) and
708
+ ns = result .getNamespace ( )
708
709
)
709
710
or
710
- result = resolveUseTreeListItem ( _, _, path )
711
+ result = resolveUseTreeListItem ( _, _, path ) and
712
+ ns = result .getNamespace ( )
711
713
}
712
714
713
715
/** Holds if path `p` must be looked up in namespace `n`. */
@@ -743,9 +745,8 @@ private predicate pathUsesNamespace(Path p, Namespace n) {
743
745
/** Gets the item that `path` resolves to, if any. */
744
746
cached
745
747
ItemNode resolvePath ( RelevantPath path ) {
746
- result = resolvePath0 ( path ) and
747
- (
748
- pathUsesNamespace ( path , result .getNamespace ( ) )
748
+ exists ( Namespace ns | result = resolvePath0 ( path , ns ) |
749
+ pathUsesNamespace ( path , ns )
749
750
or
750
751
not pathUsesNamespace ( path , _)
751
752
)
0 commit comments