aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-expr.h
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2020-12-18 21:33:09 +0800
committerSimplyTheOther <simplytheother@gmail.com>2020-12-18 21:33:09 +0800
commitaa283484a3dffedc404653af18f9413775cbc3df (patch)
tree118a5b918c48fba3261731bba0a6b4149209f7d8 /gcc/rust/ast/rust-expr.h
parentf764eeb8abf1ec50794ddb1f31bc57d025e29a3c (diff)
parentbc14d9a0cd3c67093a9c11ad368c0d28325b21c6 (diff)
downloadgcc-aa283484a3dffedc404653af18f9413775cbc3df.zip
gcc-aa283484a3dffedc404653af18f9413775cbc3df.tar.gz
gcc-aa283484a3dffedc404653af18f9413775cbc3df.tar.bz2
Merge branch 'master' of https://github.com/redbrain/gccrs
Diffstat (limited to 'gcc/rust/ast/rust-expr.h')
-rw-r--r--gcc/rust/ast/rust-expr.h36
1 files changed, 26 insertions, 10 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index f86aa54..de011c1 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -1647,7 +1647,8 @@ class StructExprFieldIdentifierValue : public StructExprFieldWithVal
public:
StructExprFieldIdentifierValue (Identifier field_identifier,
- std::unique_ptr<Expr> field_value, Location locus)
+ std::unique_ptr<Expr> field_value,
+ Location locus)
: StructExprFieldWithVal (std::move (field_value)),
field_name (std::move (field_identifier)), locus (locus)
{}
@@ -1679,7 +1680,8 @@ class StructExprFieldIndexValue : public StructExprFieldWithVal
public:
StructExprFieldIndexValue (TupleIndex tuple_index,
std::unique_ptr<Expr> field_value, Location locus)
- : StructExprFieldWithVal (std::move (field_value)), index (tuple_index), locus (locus)
+ : StructExprFieldWithVal (std::move (field_value)), index (tuple_index),
+ locus (locus)
{}
std::string as_string () const override;
@@ -2039,7 +2041,8 @@ class EnumExprFieldIdentifierValue : public EnumExprFieldWithVal
public:
EnumExprFieldIdentifierValue (Identifier field_name,
- std::unique_ptr<Expr> field_value, Location locus)
+ std::unique_ptr<Expr> field_value,
+ Location locus)
: EnumExprFieldWithVal (std::move (field_value)),
field_name (std::move (field_name)), locus (locus)
{}
@@ -2071,7 +2074,8 @@ class EnumExprFieldIndexValue : public EnumExprFieldWithVal
public:
EnumExprFieldIndexValue (TupleIndex field_index,
std::unique_ptr<Expr> field_value, Location locus)
- : EnumExprFieldWithVal (std::move (field_value)), index (field_index), locus (locus)
+ : EnumExprFieldWithVal (std::move (field_value)), index (field_index),
+ locus (locus)
{}
std::string as_string () const override;
@@ -2325,6 +2329,15 @@ public:
void mark_for_strip () override { function = nullptr; }
bool is_marked_for_strip () const override { return function == nullptr; }
+ void iterate_params (std::function<bool (Expr *)> cb)
+ {
+ for (auto it = params.begin (); it != params.end (); it++)
+ {
+ if (!cb (it->get ()))
+ return;
+ }
+ }
+
// TODO: this mutable getter seems really dodgy. Think up better way.
const std::vector<std::unique_ptr<Expr> > &get_params () const
{
@@ -2793,13 +2806,16 @@ public:
void accept_vis (ASTVisitor &vis) override;
// Can be completely empty, so have to have a separate flag.
- void mark_for_strip () override
- {
- marked_for_strip = true;
- }
- bool is_marked_for_strip () const override
+ void mark_for_strip () override { marked_for_strip = true; }
+ bool is_marked_for_strip () const override { return marked_for_strip; }
+
+ void iterate_stmts (std::function<bool (Stmt *)> cb)
{
- return marked_for_strip;
+ for (auto it = statements.begin (); it != statements.end (); it++)
+ {
+ if (!cb (it->get ()))
+ return;
+ }
}
// TODO: this mutable getter seems really dodgy. Think up better way.