aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-04-26 09:25:35 -0400
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:34:16 +0100
commit35a4c25ae45adc7439327c8981e63f824c88fa5c (patch)
treef9b74b24c16d37208e508d17a6110772712399a4 /gcc/rust
parentb911f7b85abd3bb96f35d1bd8075a07fd732c71a (diff)
downloadgcc-35a4c25ae45adc7439327c8981e63f824c88fa5c.zip
gcc-35a4c25ae45adc7439327c8981e63f824c88fa5c.tar.gz
gcc-35a4c25ae45adc7439327c8981e63f824c88fa5c.tar.bz2
gccrs: Add is_expr method to AST::Stmt
gcc/rust/ChangeLog: * ast/rust-ast.h (Stmt::is_expr): New. * ast/rust-stmt.h (ExprStmt::is_expr): New. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/ast/rust-ast.h2
-rw-r--r--gcc/rust/ast/rust-stmt.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 921832e..70d4d3d 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -901,6 +901,8 @@ public:
virtual bool is_item () const = 0;
+ virtual bool is_expr () const { return false; }
+
protected:
Stmt () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
diff --git a/gcc/rust/ast/rust-stmt.h b/gcc/rust/ast/rust-stmt.h
index 1b33e1a..59db2a8 100644
--- a/gcc/rust/ast/rust-stmt.h
+++ b/gcc/rust/ast/rust-stmt.h
@@ -198,6 +198,8 @@ public:
bool is_item () const override final { return false; }
+ bool is_expr () const override final { return true; }
+
virtual ExprStmtType get_type () const = 0;
protected: