|
| 1 | +class Element extends @element { |
| 2 | + string toString() { none() } |
| 3 | +} |
| 4 | + |
| 5 | +class Location extends @location_default { |
| 6 | + string toString() { none() } |
| 7 | +} |
| 8 | + |
| 9 | +query predicate new_closure_binders(Element id) { |
| 10 | + for_binders(id) and closure_expr_for_binders(_, id) |
| 11 | +} |
| 12 | + |
| 13 | +query predicate new_closure_binder_generic_param_lists(Element id, Element list) { |
| 14 | + for_binder_generic_param_lists(id, list) and closure_expr_for_binders(_, id) |
| 15 | +} |
| 16 | + |
| 17 | +query predicate new_where_pred_generic_param_lists(Element id, Element list) { |
| 18 | + exists(Element forBinder | |
| 19 | + where_pred_for_binders(id, forBinder) and |
| 20 | + for_binder_generic_param_lists(forBinder, list) |
| 21 | + ) |
| 22 | +} |
| 23 | + |
| 24 | +// We need to transform `TypeBound(for_binder=ForBinder(generic_param_list=X), type_repr=Y)` |
| 25 | +// into `TypeBound(type_repr=ForTypeRepr(generic_param_list=X, type_repr=Y))` |
| 26 | +// we repurpose the `@for_binder` id into a `@for_type_repr` one |
| 27 | +query predicate new_for_type_reprs(Element id) { |
| 28 | + for_type_reprs(id) or |
| 29 | + exists(Element typeBound | type_bound_for_binders(typeBound, id)) |
| 30 | +} |
| 31 | + |
| 32 | +query predicate new_for_type_repr_generic_param_lists(Element id, Element list) { |
| 33 | + exists(Element forBinder | |
| 34 | + for_type_repr_for_binders(id, forBinder) and for_binder_generic_param_lists(forBinder, list) |
| 35 | + ) |
| 36 | + or |
| 37 | + exists(Element typeBound | |
| 38 | + type_bound_for_binders(typeBound, id) and for_binder_generic_param_lists(id, list) |
| 39 | + ) |
| 40 | +} |
| 41 | + |
| 42 | +query predicate new_for_type_repr_type_reprs(Element id, Element type) { |
| 43 | + for_type_repr_type_reprs(id, type) |
| 44 | + or |
| 45 | + exists(Element typeBound | |
| 46 | + type_bound_for_binders(typeBound, id) and type_bound_type_reprs(typeBound, type) |
| 47 | + ) |
| 48 | +} |
| 49 | + |
| 50 | +query predicate new_type_bound_type_reprs(Element bound, Element type) { |
| 51 | + type_bound_type_reprs(bound, type) and not type_bound_for_binders(bound, _) |
| 52 | + or |
| 53 | + type_bound_for_binders(bound, type) |
| 54 | +} |
| 55 | + |
| 56 | +// remove locations of removed @for_binder elements |
| 57 | +query predicate new_locatable_locations(Element id, Location loc) { |
| 58 | + locatable_locations(id, loc) and not where_pred_for_binders(_, id) |
| 59 | +} |
| 60 | + |
| 61 | +// remove @asm_expr from the subtypes of @item (and therefore @addressable and @stmt) |
| 62 | +// this means removing any @asm_expr ids from tables that accept @item, @stmt or @addressable |
| 63 | +query predicate new_item_attribute_macro_expansions(Element id, Element items) { |
| 64 | + item_attribute_macro_expansions(id, items) and not asm_exprs(id) |
| 65 | +} |
| 66 | + |
| 67 | +query predicate new_item_list_items(Element id, int index, Element item) { |
| 68 | + item_list_items(id, index, item) and not asm_exprs(item) |
| 69 | +} |
| 70 | + |
| 71 | +query predicate new_macro_items_items(Element id, int index, Element item) { |
| 72 | + macro_items_items(id, index, item) and not asm_exprs(item) |
| 73 | +} |
| 74 | + |
| 75 | +query predicate new_source_file_items(Element id, int index, Element item) { |
| 76 | + source_file_items(id, index, item) and not asm_exprs(item) |
| 77 | +} |
| 78 | + |
| 79 | +query predicate new_stmt_list_statements(Element id, int index, Element stmt) { |
| 80 | + stmt_list_statements(id, index, stmt) and not asm_exprs(stmt) |
| 81 | +} |
| 82 | + |
| 83 | +query predicate new_macro_block_expr_statements(Element id, int index, Element stmt) { |
| 84 | + macro_block_expr_statements(id, index, stmt) and not asm_exprs(stmt) |
| 85 | +} |
| 86 | + |
| 87 | +query predicate new_addressable_extended_canonical_paths(Element id, string path) { |
| 88 | + addressable_extended_canonical_paths(id, path) and not asm_exprs(id) |
| 89 | +} |
| 90 | + |
| 91 | +query predicate new_addressable_crate_origins(Element id, string crate) { |
| 92 | + addressable_crate_origins(id, crate) and not asm_exprs(id) |
| 93 | +} |
0 commit comments