Skip to content

Commit b757460

Browse files
committed
Rust: Add DB downgrade script
1 parent 4ff811e commit b757460

File tree

4 files changed

+7195
-0
lines changed

4 files changed

+7195
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
class Element extends @element {
2+
string toString() { none() }
3+
}
4+
5+
newtype TAddedElement =
6+
TMacroBlockExpr(Element block) {
7+
block_exprs(block) and macro_call_macro_call_expansions(_, block)
8+
}
9+
10+
module Fresh = QlBuiltins::NewEntity<TAddedElement>;
11+
12+
class TNewElement = @element or Fresh::EntityId;
13+
14+
class NewElement extends TNewElement {
15+
string toString() { none() }
16+
}
17+
18+
query predicate new_macro_block_exprs(NewElement id) { id = Fresh::map(TMacroBlockExpr(_)) }
19+
20+
query predicate new_macro_block_expr_statements(NewElement id, int index, Element stmt) {
21+
exists(Element block |
22+
id = Fresh::map(TMacroBlockExpr(block)) and
23+
stmt_list_statements(block, index, stmt)
24+
)
25+
}
26+
27+
query predicate macro_block_expr_tail_exprs(NewElement id, Element expr) {
28+
exists(Element block |
29+
id = Fresh::map(TMacroBlockExpr(block)) and
30+
stmt_list_tail_exprs(block, expr)
31+
)
32+
}
33+
34+
query predicate new_block_exprs(Element id) {
35+
block_exprs(id) and
36+
not macro_call_macro_call_expansions(_, id)
37+
}
38+
39+
query predicate new_stmt_lists(Element id) {
40+
stmt_lists(id) and
41+
not exists(Element block |
42+
macro_call_macro_call_expansions(_, block) and
43+
block_expr_stmt_lists(block, id)
44+
)
45+
}
46+
47+
query predicate new_block_expr_stmt_lists(Element id, Element list) {
48+
block_expr_stmt_lists(id, list) and
49+
not macro_call_macro_call_expansions(_, id)
50+
}
51+
52+
query predicate new_stmt_list_statements(Element id, int index, Element stmt) {
53+
stmt_list_statements(id, index, stmt) and
54+
not exists(Element block |
55+
macro_call_macro_call_expansions(_, block) and
56+
block_expr_stmt_lists(block, id)
57+
)
58+
}
59+
60+
query predicate new_stmt_list_tail_exprs(Element id, Element expr) {
61+
stmt_list_tail_exprs(id, expr) and
62+
not exists(Element block |
63+
macro_call_macro_call_expansions(_, block) and
64+
block_expr_stmt_lists(block, id)
65+
)
66+
}
67+
68+
query predicate new_macro_call_macro_call_expansions(NewElement id, NewElement expansion) {
69+
macro_call_macro_call_expansions(id, expansion) and
70+
not block_exprs(expansion)
71+
or
72+
exists(Element block |
73+
expansion = Fresh::map(TMacroBlockExpr(block)) and
74+
macro_call_macro_call_expansions(id, block)
75+
)
76+
}

0 commit comments

Comments
 (0)