aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-02-04 20:24:32 -0500
committerPhilip Herron <philip.herron@embecosm.com>2023-04-13 11:50:47 +0000
commitb0487d6731d5d901154396e1d804a671371ac2eb (patch)
tree42a3972abb87daeef24352586c256c326b951466 /gcc
parent0a00ea70db1e99060b59e521e438fdfd4e1d98ec (diff)
downloadgcc-b0487d6731d5d901154396e1d804a671371ac2eb.zip
gcc-b0487d6731d5d901154396e1d804a671371ac2eb.tar.gz
gcc-b0487d6731d5d901154396e1d804a671371ac2eb.tar.bz2
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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/hir/tree/rust-hir-stmt.h6
-rw-r--r--gcc/rust/hir/tree/rust-hir.cc24
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 f9fc6a6..3e7697c 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 a6a1736..47c62df 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)
{
@@ -1942,26 +1942,6 @@ TupleExpr::as_string () const
}
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
{
return param_name->as_string () + " : " + type->as_string ();