aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-expr.h
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-06-12 16:36:51 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:46:29 +0100
commit128c042dcf36f28bbff612d30f1627a5c5b09a9a (patch)
tree1978d301a51da2c9bccd7643f26955d3ab33ef78 /gcc/rust/ast/rust-expr.h
parent0974798a3f5259b14b95edf9ddbe9c81af76ecff (diff)
downloadgcc-128c042dcf36f28bbff612d30f1627a5c5b09a9a.zip
gcc-128c042dcf36f28bbff612d30f1627a5c5b09a9a.tar.gz
gcc-128c042dcf36f28bbff612d30f1627a5c5b09a9a.tar.bz2
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 <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/ast/rust-expr.h')
-rw-r--r--gcc/rust/ast/rust-expr.h2
1 files changed, 2 insertions, 0 deletions
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<Attribute> &get_outer_attrs () const { return outer_attrs; }
std::vector<Attribute> &get_outer_attrs () override { return outer_attrs; }