aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-04-20 18:03:41 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-04-20 18:03:41 +0100
commit53ce1d5ac9106bc7427f14c285d782c1023124ec (patch)
tree9a02918c29fd4ebfba57afc3556d74943551c98c
parent4eaec8530371eb736717ec02daad6c252332c159 (diff)
downloadgcc-53ce1d5ac9106bc7427f14c285d782c1023124ec.zip
gcc-53ce1d5ac9106bc7427f14c285d782c1023124ec.tar.gz
gcc-53ce1d5ac9106bc7427f14c285d782c1023124ec.tar.bz2
Add ExprStmt::ExprStmtType WITH_BLOCK and WITHOUT_BLOCK to allow switching
-rw-r--r--gcc/rust/ast/rust-stmt.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/rust/ast/rust-stmt.h b/gcc/rust/ast/rust-stmt.h
index 942da7f..9d95c3e 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 */