gccrs: ast: Add accept_vis() method to `GenericArg`
authorArthur Cohen <arthur.cohen@embecosm.com>
Tue, 11 Oct 2022 13:54:07 +0000 (15:54 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 21 Feb 2023 11:36:33 +0000 (12:36 +0100)
gcc/rust/ChangeLog:

* ast/rust-path.h: Add `accept_vis` method to `GenericArg` class.

gcc/rust/ast/rust-path.h

index b12e4c2..9683ad6 100644 (file)
@@ -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);