diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-10-05 14:19:05 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-10-05 14:19:05 +0100 |
commit | 579d76f771bd18c27a527df729d0dcf460c08744 (patch) | |
tree | 9cd6c4587fbfb98fc471a26940dc1d2d15684017 /gcc/rust/backend | |
parent | 99c28309d3553346d4f0337dbae49f4a8e48da01 (diff) | |
download | gcc-579d76f771bd18c27a527df729d0dcf460c08744.zip gcc-579d76f771bd18c27a527df729d0dcf460c08744.tar.gz gcc-579d76f771bd18c27a527df729d0dcf460c08744.tar.bz2 |
Remove lambda iterator from HIR::CallExpr
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: #708
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r-- | gcc/rust/backend/rust-compile.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index 58c679f..d6c6066 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -74,11 +74,11 @@ CompileExpr::visit (HIR::CallExpr &expr) // this assumes all fields are in order from type resolution and if a // base struct was specified those fields are filed via accesors std::vector<Bexpression *> vals; - expr.iterate_params ([&] (HIR::Expr *argument) mutable -> bool { - Bexpression *e = CompileExpr::Compile (argument, ctx); - vals.push_back (e); - return true; - }); + for (auto &argument : expr.get_arguments ()) + { + Bexpression *e = CompileExpr::Compile (argument.get (), ctx); + vals.push_back (e); + } translated = ctx->get_backend ()->constructor_expression (type, vals, -1, @@ -91,12 +91,12 @@ CompileExpr::visit (HIR::CallExpr &expr) rust_assert (fn != nullptr); std::vector<Bexpression *> 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 |