diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-05 15:33:31 +0000 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2025-03-25 14:26:53 +0000 |
commit | 7215522d64f365f446c31b5a2e8ec206031562e6 (patch) | |
tree | ccdff63b5ba9ca4e08c6fdc1210c2227f095183d | |
parent | effefe8803f946e18b797d234c59e78f6fb505e9 (diff) | |
download | gcc-7215522d64f365f446c31b5a2e8ec206031562e6.zip gcc-7215522d64f365f446c31b5a2e8ec206031562e6.tar.gz gcc-7215522d64f365f446c31b5a2e8ec206031562e6.tar.bz2 |
dump: Handle let-else properly
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Add handling for diverging else
expression.
-rw-r--r-- | gcc/rust/ast/rust-ast-collector.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index b4d565c..d0ecedb 100644 --- a/gcc/rust/ast/rust-ast-collector.cc +++ b/gcc/rust/ast/rust-ast-collector.cc @@ -22,6 +22,7 @@ #include "rust-expr.h" #include "rust-item.h" #include "rust-keyword-values.h" +#include "rust-location.h" #include "rust-path.h" #include "rust-system.h" #include "rust-token.h" @@ -2587,6 +2588,13 @@ TokenCollector::visit (LetStmt &stmt) push (Rust::Token::make (EQUAL, UNDEF_LOCATION)); visit (stmt.get_init_expr ()); } + + if (stmt.has_else_expr ()) + { + push (Rust::Token::make (ELSE, UNDEF_LOCATION)); + visit (stmt.get_else_expr ()); + } + push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION)); } |