public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Move method as_string into HIR::ExprStmt from deriving classes
@ 2023-04-13 13:25 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-13 13:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b0487d6731d5d901154396e1d804a671371ac2eb

commit b0487d6731d5d901154396e1d804a671371ac2eb
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date:   Sat Feb 4 20:24:32 2023 -0500

    Move method as_string into HIR::ExprStmt from deriving classes
    
    gcc/rust/ChangeLog:
    
            * hir/tree/rust-hir.cc
            (ExprStmt::as_string): Add method.
            (ExprStmtWithBlock::as_string): Remove method.
            (ExprStmtWithoutBlock::as_string): Remove method.
            * hir/tree/rust-hir-stmt.h
            (ExprStmt::as_string): Add method.
            (ExprStmtWithBlock::as_string): Remove method.
            (ExprStmtWithoutBlock::as_string): Remove method.
    
    Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>

Diff:
---
 gcc/rust/hir/tree/rust-hir-stmt.h |  6 ++----
 gcc/rust/hir/tree/rust-hir.cc     | 24 ++----------------------
 2 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/gcc/rust/hir/tree/rust-hir-stmt.h b/gcc/rust/hir/tree/rust-hir-stmt.h
index f9fc6a646d7..3e7697c8e21 100644
--- a/gcc/rust/hir/tree/rust-hir-stmt.h
+++ b/gcc/rust/hir/tree/rust-hir-stmt.h
@@ -162,6 +162,8 @@ class ExprStmt : public Stmt
   Location locus;
 
 public:
+  std::string as_string () const override;
+
   Location get_locus () const override final { return locus; }
 
   bool is_item () const override final { return false; }
@@ -199,8 +201,6 @@ class ExprStmtWithoutBlock : public ExprStmt
 {
 
 public:
-  std::string as_string () const override;
-
   ExprStmtWithoutBlock (Analysis::NodeMapping mappings,
 			std::unique_ptr<Expr> expr, Location locus)
     : ExprStmt (std::move (mappings), std::move (expr), locus)
@@ -224,8 +224,6 @@ class ExprStmtWithBlock : public ExprStmt
   bool must_be_unit;
 
 public:
-  std::string as_string () const override;
-
   ExprStmtWithBlock (Analysis::NodeMapping mappings,
 		     std::unique_ptr<ExprWithBlock> expr, Location locus,
 		     bool must_be_unit)
diff --git a/gcc/rust/hir/tree/rust-hir.cc b/gcc/rust/hir/tree/rust-hir.cc
index a6a1736132f..47c62dfb481 100644
--- a/gcc/rust/hir/tree/rust-hir.cc
+++ b/gcc/rust/hir/tree/rust-hir.cc
@@ -1075,9 +1075,9 @@ PathInExpression::as_string () const
 }
 
 std::string
-ExprStmtWithBlock::as_string () const
+ExprStmt::as_string () const
 {
-  std::string str = indent_spaces (enter) + "ExprStmtWithBlock: \n";
+  std::string str = indent_spaces (enter) + "ExprStmt:\n";
 
   if (expr == nullptr)
     {
@@ -1941,26 +1941,6 @@ TupleExpr::as_string () const
   return str;
 }
 
-std::string
-ExprStmtWithoutBlock::as_string () const
-{
-  std::string str ("ExprStmtWithoutBlock:\n");
-  indent_spaces (enter);
-  str += indent_spaces (stay);
-
-  if (expr == nullptr)
-    {
-      str += "none (this shouldn't happen and is probably an error)";
-    }
-  else
-    {
-      str += expr->as_string ();
-    }
-  indent_spaces (out);
-
-  return str;
-}
-
 std::string
 FunctionParam::as_string () const
 {

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

only message in thread, other threads:[~2023-04-13 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-13 13:25 [gcc/devel/rust/master] Move method as_string into HIR::ExprStmt from deriving classes 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).