File tree Expand file tree Collapse file tree 4 files changed +22
-48
lines changed Expand file tree Collapse file tree 4 files changed +22
-48
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,25 @@ module Impl {
4646 predicate fromSource ( ) { exists ( this .getFile ( ) .getRelativePath ( ) ) }
4747 }
4848
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+
4963 /** Gets the non-synthesized location of `l`, if any. */
5064 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 ) )
5569 }
5670}
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ query predicate multipleLocations(Locatable e) { strictcount(e.getLocation()) >
2525 * Holds if `e` does not have a `Location`.
2626 */
2727query 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 ( )
2930}
3031
3132private 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