File tree Expand file tree Collapse file tree
rust/downgrades/9487e73d9da6508522f07a34bc4aafa8d55c0f5f Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,24 @@ class Location extends @location_default {
77}
88
99// `CfgPredExpr` and `CfgPredPat` are new node kinds with no representation in the old schema, so we
10- // scrub their locations.
10+ // scrub their locations and references to them.
11+ private predicate deletedNode ( Element id ) { cfg_pred_exprs ( id ) or cfg_pred_pats ( id ) }
12+
13+ // Comments attached to deleted nodes are also removed, along with their locations.
14+ private predicate deletedElement ( Element id ) {
15+ deletedNode ( id )
16+ or
17+ exists ( Element parent | comments ( id , parent , _) and deletedNode ( parent ) )
18+ }
19+
1120query predicate new_locatable_locations ( Element id , Location location ) {
12- locatable_locations ( id , location ) and not cfg_pred_exprs ( id ) and not cfg_pred_pats ( id )
21+ locatable_locations ( id , location ) and not deletedElement ( id )
22+ }
23+
24+ query predicate new_macro_call_macro_call_expansions ( Element macroCall , Element expansion ) {
25+ macro_call_macro_call_expansions ( macroCall , expansion ) and not deletedNode ( expansion )
26+ }
27+
28+ query predicate new_comments ( Element id , Element parent , string text ) {
29+ comments ( id , parent , text ) and not deletedNode ( parent )
1330}
Original file line number Diff line number Diff line change @@ -6,3 +6,5 @@ cfg_pred_expr_cfg_predicates.rel: delete
66cfg_pred_pats.rel : delete
77cfg_pred_pat_cfg_predicates.rel : delete
88locatable_locations.rel : run downgrade.ql new_locatable_locations
9+ macro_call_macro_call_expansions.rel : run downgrade.ql new_macro_call_macro_call_expansions
10+ comments.rel : run downgrade.ql new_comments
You can’t perform that action at this time.
0 commit comments