Skip to content

Commit c84cec9

Browse files
authored
Merge pull request #20664 from hvitved/rust/callable-get-body
Rust: Add `Callable.getBody()`
2 parents 5d2ddbf + 4b6c390 commit c84cec9

File tree

33 files changed

+14641
-105
lines changed

33 files changed

+14641
-105
lines changed

rust/ast-generator/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ fn property_name(type_name: &str, field_name: &str) -> String {
4444
("StructField", "expr") => "default",
4545
("UseTree", "is_star") => "is_glob",
4646
(_, "ty") => "type_repr",
47+
("Function", "body") => "function_body",
48+
("ClosureExpr", "body") => "closure_body",
4749
_ if field_name.contains("record") => &field_name.replacen("record", "struct", 1),
4850
_ => field_name,
4951
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Element extends @element {
2+
string toString() { none() }
3+
}
4+
5+
class Expr extends Element, @expr { }
6+
7+
class ClosureExpr extends Expr, @closure_expr { }
8+
9+
class Function extends Element, @function { }
10+
11+
query predicate new_closure_expr_bodies(ClosureExpr ce, Expr e) {
12+
closure_expr_closure_bodies(ce, e)
13+
}
14+
15+
query predicate new_function_bodies(Function f, Expr e) { function_function_bodies(f, e) }

0 commit comments

Comments
 (0)