@@ -561,17 +561,17 @@ abstract class ImplOrTraitItemNode extends ItemNode {
561
561
562
562
pragma [ nomagic]
563
563
private TypeParamItemNode resolveTypeParamPathTypeRepr ( PathTypeRepr ptr ) {
564
- result = resolvePathFull ( ptr .getPath ( ) )
564
+ result = resolvePath ( ptr .getPath ( ) )
565
565
}
566
566
567
567
class ImplItemNode extends ImplOrTraitItemNode instanceof Impl {
568
568
Path getSelfPath ( ) { result = super .getSelfTy ( ) .( PathTypeRepr ) .getPath ( ) }
569
569
570
570
Path getTraitPath ( ) { result = super .getTrait ( ) .( PathTypeRepr ) .getPath ( ) }
571
571
572
- ItemNode resolveSelfTy ( ) { result = resolvePathFull ( this .getSelfPath ( ) ) }
572
+ ItemNode resolveSelfTy ( ) { result = resolvePath ( this .getSelfPath ( ) ) }
573
573
574
- TraitItemNode resolveTraitTy ( ) { result = resolvePathFull ( this .getTraitPath ( ) ) }
574
+ TraitItemNode resolveTraitTy ( ) { result = resolvePath ( this .getTraitPath ( ) ) }
575
575
576
576
override AssocItemNode getAnAssocItem ( ) { result = super .getAssocItemList ( ) .getAnAssocItem ( ) }
577
577
@@ -665,7 +665,7 @@ private class ImplTraitTypeReprItemNode extends ItemNode instanceof ImplTraitTyp
665
665
}
666
666
667
667
pragma [ nomagic]
668
- ItemNode resolveABound ( ) { result = resolvePathFull ( this .getABoundPath ( ) ) }
668
+ ItemNode resolveABound ( ) { result = resolvePath ( this .getABoundPath ( ) ) }
669
669
670
670
override string getName ( ) { result = "(impl trait)" }
671
671
@@ -795,7 +795,7 @@ class TraitItemNode extends ImplOrTraitItemNode, TypeItemNode instanceof Trait {
795
795
}
796
796
797
797
pragma [ nomagic]
798
- ItemNode resolveABound ( ) { result = resolvePathFull ( this .getABoundPath ( ) ) }
798
+ ItemNode resolveABound ( ) { result = resolvePath ( this .getABoundPath ( ) ) }
799
799
800
800
override AssocItemNode getAnAssocItem ( ) { result = super .getAssocItemList ( ) .getAnAssocItem ( ) }
801
801
@@ -847,7 +847,7 @@ class TraitItemNode extends ImplOrTraitItemNode, TypeItemNode instanceof Trait {
847
847
848
848
class TypeAliasItemNode extends TypeItemNode , AssocItemNode instanceof TypeAlias {
849
849
pragma [ nomagic]
850
- ItemNode resolveAlias ( ) { result = resolvePathFull ( super .getTypeRepr ( ) .( PathTypeRepr ) .getPath ( ) ) }
850
+ ItemNode resolveAlias ( ) { result = resolvePath ( super .getTypeRepr ( ) .( PathTypeRepr ) .getPath ( ) ) }
851
851
852
852
override string getName ( ) { result = TypeAlias .super .getName ( ) .getText ( ) }
853
853
@@ -941,7 +941,7 @@ class TypeParamItemNode extends TypeItemNode instanceof TypeParam {
941
941
}
942
942
943
943
pragma [ nomagic]
944
- ItemNode resolveABound ( ) { result = resolvePathFull ( this .getABoundPath ( ) ) }
944
+ ItemNode resolveABound ( ) { result = resolvePath ( this .getABoundPath ( ) ) }
945
945
946
946
/**
947
947
* Holds if this type parameter has a trait bound. Examples:
@@ -1369,14 +1369,9 @@ private predicate pathUsesNamespace(Path p, Namespace n) {
1369
1369
)
1370
1370
}
1371
1371
1372
- /**
1373
- * Gets the item that `path` resolves to, if any.
1374
- *
1375
- * Whenever `path` can resolve to both a function in source code and in library
1376
- * code, both are included
1377
- */
1378
- pragma [ nomagic]
1379
- private ItemNode resolvePathFull ( RelevantPath path ) {
1372
+ /** Gets the item that `path` resolves to, if any. */
1373
+ cached
1374
+ ItemNode resolvePath ( RelevantPath path ) {
1380
1375
exists ( Namespace ns | result = resolvePath0 ( path , ns ) |
1381
1376
pathUsesNamespace ( path , ns )
1382
1377
or
@@ -1385,30 +1380,9 @@ private ItemNode resolvePathFull(RelevantPath path) {
1385
1380
)
1386
1381
}
1387
1382
1388
- pragma [ nomagic]
1389
- private predicate resolvesSourceFunction ( RelevantPath path ) {
1390
- resolvePathFull ( path ) .( Function ) .fromSource ( )
1391
- }
1392
-
1393
- /** Gets the item that `path` resolves to, if any. */
1394
- cached
1395
- ItemNode resolvePath ( RelevantPath path ) {
1396
- result = resolvePathFull ( path ) and
1397
- (
1398
- // when a function exists in both source code and in library code, it is because
1399
- // we also extracted the source code as library code, and hence we only want
1400
- // the function from source code
1401
- result .fromSource ( )
1402
- or
1403
- not result instanceof Function
1404
- or
1405
- not resolvesSourceFunction ( path )
1406
- )
1407
- }
1408
-
1409
1383
pragma [ nomagic]
1410
1384
private ItemNode resolvePathQualifier ( RelevantPath path , string name ) {
1411
- result = resolvePathFull ( path .getQualifier ( ) ) and
1385
+ result = resolvePath ( path .getQualifier ( ) ) and
1412
1386
name = path .getText ( )
1413
1387
}
1414
1388
@@ -1454,7 +1428,7 @@ private ItemNode resolveUseTreeListItemQualifier(
1454
1428
pragma [ nomagic]
1455
1429
private ItemNode resolveUseTreeListItem ( Use use , UseTree tree ) {
1456
1430
tree = use .getUseTree ( ) and
1457
- result = resolvePathFull ( tree .getPath ( ) )
1431
+ result = resolvePath ( tree .getPath ( ) )
1458
1432
or
1459
1433
result = resolveUseTreeListItem ( use , tree , tree .getPath ( ) )
1460
1434
}
0 commit comments