aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-10-11 15:54:07 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2023-02-21 12:36:33 +0100
commit2f1035fc91ce1b9dd6e08d47befefff6b2b878db (patch)
tree9ca126b4d64efbe1cd53af93d65db1a29c2fb5a1
parent295cd26508882551111817f2216ecfbb2f4c467b (diff)
downloadgcc-2f1035fc91ce1b9dd6e08d47befefff6b2b878db.zip
gcc-2f1035fc91ce1b9dd6e08d47befefff6b2b878db.tar.gz
gcc-2f1035fc91ce1b9dd6e08d47befefff6b2b878db.tar.bz2
gccrs: ast: Add accept_vis() method to `GenericArg`
gcc/rust/ChangeLog: * ast/rust-path.h: Add `accept_vis` method to `GenericArg` class.
-rw-r--r--gcc/rust/ast/rust-path.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h
index b12e4c2..9683ad6 100644
--- a/gcc/rust/ast/rust-path.h
+++ b/gcc/rust/ast/rust-path.h
@@ -207,6 +207,23 @@ public:
Kind get_kind () const { return kind; }
const Location &get_locus () const { return locus; }
+ void accept_vis (AST::ASTVisitor &visitor)
+ {
+ switch (get_kind ())
+ {
+ case Kind::Const:
+ get_expression ()->accept_vis (visitor);
+ break;
+ case Kind::Type:
+ get_type ()->accept_vis (visitor);
+ break;
+ case Kind::Either:
+ break;
+ case Kind::Error:
+ gcc_unreachable ();
+ }
+ }
+
std::unique_ptr<Expr> &get_expression ()
{
rust_assert (kind == Kind::Const);