public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Add ExprStmt::ExprStmtType WITH_BLOCK and WITHOUT_BLOCK to allow switching
@ 2022-06-08 12:33 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:33 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:53ce1d5ac9106bc7427f14c285d782c1023124ec

commit 53ce1d5ac9106bc7427f14c285d782c1023124ec
Author: Philip Herron <philip.herron@embecosm.com>
Date:   Wed Apr 20 18:03:41 2022 +0100

    Add ExprStmt::ExprStmtType WITH_BLOCK and WITHOUT_BLOCK to allow switching

Diff:
---
 gcc/rust/ast/rust-stmt.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/ast/rust-stmt.h b/gcc/rust/ast/rust-stmt.h
index 942da7f4db5..9d95c3e27e8 100644
--- a/gcc/rust/ast/rust-stmt.h
+++ b/gcc/rust/ast/rust-stmt.h
@@ -183,8 +183,14 @@ protected:
  * expression) */
 class ExprStmt : public Stmt
 {
-  // TODO: add any useful virtual functions
+public:
+  enum ExprStmtType
+  {
+    WITH_BLOCK,
+    WITHOUT_BLOCK
+  };
 
+protected:
   Location locus;
 
 public:
@@ -192,6 +198,8 @@ public:
 
   bool is_item () const override final { return false; }
 
+  virtual ExprStmtType get_type () const = 0;
+
 protected:
   ExprStmt (Location locus) : locus (locus) {}
 };
@@ -261,6 +269,11 @@ public:
     return expr;
   }
 
+  ExprStmtType get_type () const override
+  {
+    return ExprStmtType::WITHOUT_BLOCK;
+  };
+
 protected:
   /* Use covariance to implement clone function as returning this object rather
    * than base */
@@ -328,6 +341,8 @@ public:
 
   bool is_semicolon_followed () const { return semicolon_followed; }
 
+  ExprStmtType get_type () const override { return ExprStmtType::WITH_BLOCK; };
+
 protected:
   /* Use covariance to implement clone function as returning this object rather
    * than base */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:33 [gcc/devel/rust/master] Add ExprStmt::ExprStmtType WITH_BLOCK and WITHOUT_BLOCK to allow switching Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).