[gcc r14-7547] gccrs: Add is_expr method to AST::Stmt

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:43:25 GMT 2024


https://gcc.gnu.org/g:35a4c25ae45adc7439327c8981e63f824c88fa5c

commit r14-7547-g35a4c25ae45adc7439327c8981e63f824c88fa5c
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date:   Wed Apr 26 09:25:35 2023 -0400

    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>

Diff:
---
 gcc/rust/ast/rust-ast.h  | 2 ++
 gcc/rust/ast/rust-stmt.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 921832ea501..70d4d3ddc1c 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 1b33e1a2e4b..59db2a8bca2 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:


More information about the Gcc-cvs mailing list