diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-05 15:33:31 +0000 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-31 21:07:15 +0200 |
commit | d68ebd1abff36196608e3411a8b1cddd6be80e0f (patch) | |
tree | cd6ef6acbec7cb867b8d74487523b6db5333c9cf /gcc | |
parent | 010890e3f99e8cd771b7f3f126d2a5be63a2ba46 (diff) | |
download | gcc-d68ebd1abff36196608e3411a8b1cddd6be80e0f.zip gcc-d68ebd1abff36196608e3411a8b1cddd6be80e0f.tar.gz gcc-d68ebd1abff36196608e3411a8b1cddd6be80e0f.tar.bz2 |
gccrs: dump: Handle let-else properly
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Add handling for diverging else
expression.
Diffstat (limited to 'gcc')
-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 073fa72..3297407 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)); } |