]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: ast: Add AST::Kind::IDENTIFIER
authorSergey Bugaev <bugaevc@gmail.com>
Mon, 3 Apr 2023 15:48:45 +0000 (18:48 +0300)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:34:08 +0000 (18:34 +0100)
...and return it from IdentifierExpr::get_ast_kind (). This enables
other code to dynamically test whether an expression is in fact an
IdentifierExpr.

gcc/rust/ChangeLog:
* ast/rust-ast.h: Add AST::Kind::IDENTIFIER

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
gcc/rust/ast/rust-ast.h

index 3aed56aa7b68a2633add6562c069208145bd3f97..921832ea5010c17f2983b665907a2911a14de7a2 100644 (file)
@@ -44,6 +44,7 @@ enum class Kind
   UNKNOWN,
   MACRO_RULES_DEFINITION,
   MACRO_INVOCATION,
+  IDENTIFIER,
 };
 
 class Visitable
@@ -1072,6 +1073,8 @@ public:
     outer_attrs = std::move (new_attrs);
   }
 
+  Kind get_ast_kind () const override { return Kind::IDENTIFIER; }
+
 protected:
   // Clone method implementation
   IdentifierExpr *clone_expr_without_block_impl () const final override