aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-10-05 14:30:58 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-10-05 14:30:58 +0100
commit6cd07341b1057961bebc8c11d70909ccac781113 (patch)
tree1ff96defb6aaccb991c732f3a8aadf445f746849 /gcc/rust/backend
parent579d76f771bd18c27a527df729d0dcf460c08744 (diff)
downloadgcc-6cd07341b1057961bebc8c11d70909ccac781113.zip
gcc-6cd07341b1057961bebc8c11d70909ccac781113.tar.gz
gcc-6cd07341b1057961bebc8c11d70909ccac781113.tar.bz2
Remove lambda iterator from HIR::MethodCallExpr
This removes the bad code style lambda iterators for arguments. They are a bad design choice for static analysis code since the user of the api looses scope to break/return outside from the caller api. This will need to be added to a style-guide in the future. Fixes: #709
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc
index d6c6066..d1fd064 100644
--- a/gcc/rust/backend/rust-compile.cc
+++ b/gcc/rust/backend/rust-compile.cc
@@ -224,12 +224,12 @@ CompileExpr::visit (HIR::MethodCallExpr &expr)
std::vector<Bexpression *> args;
args.push_back (self_argument);
- expr.iterate_params ([&] (HIR::Expr *p) mutable -> bool {
- Bexpression *compiled_expr = CompileExpr::Compile (p, ctx);
- rust_assert (compiled_expr != nullptr);
- args.push_back (compiled_expr);
- return true;
- });
+ for (auto &argument : expr.get_arguments ())
+ {
+ Bexpression *compiled_expr
+ = CompileExpr::Compile (argument.get (), ctx);
+ args.push_back (compiled_expr);
+ }
Bexpression *fn_expr
= ctx->get_backend ()->var_expression (fn_convert_expr_tmp,
@@ -414,12 +414,11 @@ CompileExpr::visit (HIR::MethodCallExpr &expr)
args.push_back (self);
// normal args
- expr.iterate_params ([&] (HIR::Expr *p) mutable -> bool {
- Bexpression *compiled_expr = CompileExpr::Compile (p, ctx);
- rust_assert (compiled_expr != nullptr);
- args.push_back (compiled_expr);
- return true;
- });
+ for (auto &argument : expr.get_arguments ())
+ {
+ Bexpression *compiled_expr = CompileExpr::Compile (argument.get (), ctx);
+ args.push_back (compiled_expr);
+ }
auto fncontext = ctx->peek_fn ();
translated