Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions rust/ast-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ fn class_name(type_name: &str) -> String {
"Literal" => "LiteralExpr".to_owned(),
"ArrayExpr" => "ArrayExprInternal".to_owned(),
"AsmOptions" => "AsmOptionsList".to_owned(),
"MacroStmts" => "MacroBlockExpr".to_owned(),
_ if type_name.starts_with("Record") => type_name.replacen("Record", "Struct", 1),
_ if type_name.ends_with("Type") => format!("{type_name}Repr"),
_ => type_name.to_owned(),
Expand All @@ -36,7 +35,6 @@ fn property_name(type_name: &str, field_name: &str) -> String {
("MatchExpr", "expr") => "scrutinee",
("Variant", "expr") => "discriminant",
("FieldExpr", "expr") => "container",
("MacroBlockExpr", "expr") => "tail_expr",
(_, "name_ref") => "identifier",
(_, "then_branch") => "then",
(_, "else_branch") => "else_",
Expand Down
2 changes: 1 addition & 1 deletion rust/extractor/src/generated/.generated.list

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 0 additions & 63 deletions rust/extractor/src/generated/top.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions rust/extractor/src/translate/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ impl<'a> Translator<'a> {
pub(crate) fn emit_macro_stmts(
&mut self,
node: &ast::MacroStmts,
) -> Option<Label<generated::MacroBlockExpr>> {
) -> Option<Label<generated::BlockExpr>> {
// not generated to work around a bug in rust-analyzer AST generation machinery.
// Because an Expr can also be a Stmt (AsmExpr: Expr and AsmExpr: Item: Stmt)
// then such an element will be returned by both `expr()` and `statements()`
Expand All @@ -537,10 +537,23 @@ impl<'a> Translator<'a> {
.iter()
.filter_map(|x| self.emit_stmt(x))
.collect();
let label = self.trap.emit(generated::MacroBlockExpr {
let stmt_list = self.trap.emit(generated::StmtList {
id: TrapId::Star,
tail_expr,
attrs: vec![],
statements,
tail_expr,
});
let label = self.trap.emit(generated::BlockExpr {
id: TrapId::Star,
label: None,
attrs: vec![],
is_async: false,
is_const: false,
is_gen: false,
is_move: false,
is_try: false,
is_unsafe: false,
stmt_list: Some(stmt_list),
});
self.emit_location(label, node);
self.emit_tokens(node, label.into(), node.syntax().children_with_tokens());
Expand Down
17 changes: 6 additions & 11 deletions rust/ql/.generated.list

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading