File tree 4 files changed +22
-48
lines changed
4 files changed +22
-48
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,25 @@ module Impl {
46
46
predicate fromSource ( ) { exists ( this .getFile ( ) .getRelativePath ( ) ) }
47
47
}
48
48
49
+ private @location_default getDbLocation ( Locatable l ) {
50
+ locatable_locations ( Synth:: convertLocatableToRaw ( l ) , result )
51
+ }
52
+
53
+ private MacroCall getImmediatelyEnclosingMacroCall ( AstNode n ) {
54
+ result = n .getParentNode ( )
55
+ or
56
+ exists ( AstNode mid |
57
+ result = getImmediatelyEnclosingMacroCall ( mid ) and
58
+ n .getParentNode ( ) = mid and
59
+ not mid instanceof MacroCall
60
+ )
61
+ }
62
+
49
63
/** Gets the non-synthesized location of `l`, if any. */
50
64
LocationImpl:: LocationDefault getLocationDefault ( Locatable l ) {
51
- exists ( @location_default location |
52
- result = LocationImpl :: TLocationDefault ( location ) and
53
- locatable_locations ( Synth :: convertLocatableToRaw ( l ) , location )
54
- )
65
+ result = LocationImpl :: TLocationDefault ( getDbLocation ( l ) )
66
+ or
67
+ not exists ( getDbLocation ( l ) ) and
68
+ result = getLocationDefault ( getImmediatelyEnclosingMacroCall ( l ) )
55
69
}
56
70
}
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ query predicate multipleLocations(Locatable e) { strictcount(e.getLocation()) >
25
25
* Holds if `e` does not have a `Location`.
26
26
*/
27
27
query predicate noLocation ( Locatable e ) {
28
- not exists ( e .getLocation ( ) ) and not e .( AstNode ) .getParentNode * ( ) = any ( Crate c ) .getModule ( )
28
+ not exists ( e .getLocation ( ) ) and
29
+ not e .( AstNode ) .getParentNode * ( ) = any ( Crate c ) .getModule ( )
29
30
}
30
31
31
32
private predicate multiplePrimaryQlClasses ( Element e ) {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- | gen_macro_items.rs:5:5:5:38 | MacroItems | 0 | file://:0:0:0:0 | use ...::Path |
2
- | gen_macro_items.rs:5:5:5:38 | MacroItems | 1 | file://:0:0:0:0 | fn get_parent |
1
+ | gen_macro_items.rs:5:5:5:38 | MacroItems | 0 | gen_macro_items.rs:5:5:5:38 | use ...::Path |
2
+ | gen_macro_items.rs:5:5:5:38 | MacroItems | 1 | gen_macro_items.rs:5:5:5:38 | fn get_parent |
You can’t perform that action at this time.
0 commit comments