Skip to content

Commit 7215522

Browse files
committed
dump: Handle let-else properly
gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Add handling for diverging else expression.
1 parent effefe8 commit 7215522

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gcc/rust/ast/rust-ast-collector.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "rust-expr.h"
2323
#include "rust-item.h"
2424
#include "rust-keyword-values.h"
25+
#include "rust-location.h"
2526
#include "rust-path.h"
2627
#include "rust-system.h"
2728
#include "rust-token.h"
@@ -2587,6 +2588,13 @@ TokenCollector::visit (LetStmt &stmt)
25872588
push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
25882589
visit (stmt.get_init_expr ());
25892590
}
2591+
2592+
if (stmt.has_else_expr ())
2593+
{
2594+
push (Rust::Token::make (ELSE, UNDEF_LOCATION));
2595+
visit (stmt.get_else_expr ());
2596+
}
2597+
25902598
push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
25912599
}
25922600

0 commit comments

Comments
 (0)