aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-ast-resolve-expr.cc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-12-21 22:56:52 +0000
committerCohenArthur <arthur.cohen@embecosm.com>2025-01-06 10:08:17 +0000
commit26d3103c2d65741221920a0239d9f02ac5e61e6d (patch)
tree5c7e77c54849d5bf6e55d350e5b280971a98f7d0 /gcc/rust/resolve/rust-ast-resolve-expr.cc
parent43369f262c5a3dc63ae6a14c679f25d06256084d (diff)
downloadgcc-26d3103c2d65741221920a0239d9f02ac5e61e6d.zip
gcc-26d3103c2d65741221920a0239d9f02ac5e61e6d.tar.gz
gcc-26d3103c2d65741221920a0239d9f02ac5e61e6d.tar.bz2
ast: Add new Kind enums for more precise downcasting
This commit adds things like Item::Kind, Expr::Kind, etc, and implements the associated `get_*_kind` functions. It also removes the more generic AST::Kind enum we were using, which was incomplete and painful to use. gcc/rust/ChangeLog: * ast/rust-ast.h: Add new Kind enums, remove Node class. * ast/rust-builtin-ast-nodes.h: Use new Kind enums. * ast/rust-expr.h (class LoopLabel): Likewise. * ast/rust-item.h: Likewise. * ast/rust-macro.h: Likewise. * ast/rust-path.h: Likewise. * expand/rust-macro-builtins-helpers.cc: Likewise. * expand/rust-macro-builtins-utility.cc (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::stringify_handler): Likewise. * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise. * resolve/rust-early-name-resolver.cc: Likewise. * hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Likewise.
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve-expr.cc')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-expr.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.cc b/gcc/rust/resolve/rust-ast-resolve-expr.cc
index 9c2be4a..5936cf2 100644
--- a/gcc/rust/resolve/rust-ast-resolve-expr.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-expr.cc
@@ -536,7 +536,7 @@ ResolveExpr::visit (AST::BreakExpr &expr)
{
bool funny_error = false;
auto &break_expr = expr.get_break_expr ();
- if (break_expr.get_ast_kind () == AST::Kind::IDENTIFIER)
+ if (break_expr.get_expr_kind () == AST::Expr::Kind::Identifier)
{
/* This is a break with an expression, and the expression is
just a single identifier. See if the identifier is either