Skip to content

Commit ed00507

Browse files
committed
Ruby: upgrade/downgrade scripts
1 parent 59773eb commit ed00507

28 files changed

+6284
-0
lines changed

ruby/downgrades/3595c826de6db850f16b9da265a54dbf24dd3126/old.dbscheme

Lines changed: 1435 additions & 0 deletions
Large diffs are not rendered by default.

ruby/downgrades/3595c826de6db850f16b9da265a54dbf24dd3126/ruby.dbscheme

Lines changed: 1433 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
class AstNode extends @ruby_ast_node_parent {
2+
string toString() { none() }
3+
}
4+
5+
class Location extends @location {
6+
string toString() { none() }
7+
}
8+
9+
class Wrapper = @ruby_body_statement or @ruby_block_body;
10+
11+
predicate astNodeInfo(AstNode child, AstNode parent, int primaryIndex, int secondaryIndex) {
12+
not parent instanceof Wrapper and
13+
exists(AstNode node, Location l |
14+
ruby_ast_node_info(node, parent, primaryIndex, _) and
15+
(
16+
not node instanceof Wrapper and secondaryIndex = 0 and child = node
17+
or
18+
node instanceof Wrapper and ruby_ast_node_info(child, node, secondaryIndex, _)
19+
)
20+
)
21+
}
22+
23+
from AstNode node, AstNode parent, int parent_index, Location loc
24+
where
25+
node =
26+
rank[parent_index + 1](AstNode n, int i, int j | astNodeInfo(n, parent, i, j) | n order by i, j) and
27+
ruby_ast_node_info(node, _, _, loc)
28+
select node, parent, parent_index, loc
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class AstNode extends @ruby_ast_node {
2+
string toString() { none() }
3+
}
4+
5+
from AstNode ruby_block, AstNode body, int index, AstNode child
6+
where ruby_block_body(ruby_block, body) and ruby_block_body_child(body, index, child)
7+
select ruby_block, index, child
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class AstNode extends @ruby_ast_node {
2+
string toString() { none() }
3+
}
4+
5+
from AstNode ruby_class, AstNode body, int index, AstNode child
6+
where ruby_class_body(ruby_class, body) and ruby_body_statement_child(body, index, child)
7+
select ruby_class, index, child
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class AstNode extends @ruby_ast_node {
2+
string toString() { none() }
3+
}
4+
5+
from AstNode ruby_do_block, AstNode body, int index, AstNode child
6+
where ruby_do_block_body(ruby_do_block, body) and ruby_body_statement_child(body, index, child)
7+
select ruby_do_block, index, child
8+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class AstNode extends @ruby_ast_node {
2+
string toString() { none() }
3+
}
4+
5+
from AstNode ruby_method, int index, AstNode child
6+
where
7+
exists(AstNode body |
8+
ruby_method_body(ruby_method, body) and ruby_body_statement_child(body, index, child)
9+
)
10+
or
11+
ruby_method_body(ruby_method, child) and
12+
not child instanceof @ruby_body_statement and
13+
index = 0
14+
select ruby_method, index, child
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class AstNode extends @ruby_ast_node {
2+
string toString() { none() }
3+
}
4+
5+
from AstNode ruby_module, AstNode body, int index, AstNode child
6+
where ruby_module_body(ruby_module, body) and ruby_body_statement_child(body, index, child)
7+
select ruby_module, index, child
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class AstNode extends @ruby_ast_node {
2+
string toString() { none() }
3+
}
4+
5+
from AstNode ruby_singleton_class, AstNode body, int index, AstNode child
6+
where ruby_singleton_class_body(ruby_singleton_class, body) and ruby_body_statement_child(body, index, child)
7+
select ruby_singleton_class, index, child
8+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class AstNode extends @ruby_ast_node {
2+
string toString() { none() }
3+
}
4+
5+
from AstNode ruby_singleton_method, int index, AstNode child
6+
where
7+
exists(AstNode body |
8+
ruby_singleton_method_body(ruby_singleton_method, body) and
9+
ruby_body_statement_child(body, index, child)
10+
)
11+
or
12+
ruby_singleton_method_body(ruby_singleton_method, child) and
13+
not child instanceof @ruby_body_statement and
14+
index = 0
15+
select ruby_singleton_method, index, child

0 commit comments

Comments
 (0)