From 128c042dcf36f28bbff612d30f1627a5c5b09a9a Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Mon, 12 Jun 2023 16:36:51 +0200 Subject: gccrs: expand: Convert last statement to tail expr Some inner statements may be expanded to statements as well as a tail expression, which should then be propagated to the parent tail expression field. gcc/rust/ChangeLog: * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Change call to expand_inner_stmts. (expand_tail_expr): Change argument name and try to expand the last statement as a tail expression once all statements have been expanded. * expand/rust-expand-visitor.h: Change prototype to accept parent class. * ast/rust-expr.h: Add try_convert_last_stmt function prototype. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/ast/rust-expr.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/rust/ast') diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index 2791a8c..8ea2c8c 100644 --- a/gcc/rust/ast/rust-expr.h +++ b/gcc/rust/ast/rust-expr.h @@ -2503,6 +2503,8 @@ public: // Normalizes a trailing statement without a semicolon to a tail expression. void normalize_tail_expr (); + void try_convert_last_stmt (); + const std::vector &get_outer_attrs () const { return outer_attrs; } std::vector &get_outer_attrs () override { return outer_attrs; } -- cgit v1.1