From 08b83163db07c903a6524f15f9adce4a0e7fa359 Mon Sep 17 00:00:00 2001 From: Nirmal Patel Date: Thu, 28 Oct 2021 13:58:03 -0400 Subject: Remove iterate_params from AST::CallExpr and AST::MethodCallExpr These lambda iterators are removed because they make working with IR more complex. Instead, we are using the get_params () to access the parameters with the help of a for loop. Fixes #722 #723 Signed-off-by: Nirmal Patel --- gcc/rust/hir/rust-ast-lower-expr.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'gcc/rust/hir') diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h index 782045d..54cb6113 100644 --- a/gcc/rust/hir/rust-ast-lower-expr.h +++ b/gcc/rust/hir/rust-ast-lower-expr.h @@ -192,12 +192,14 @@ public: { HIR::Expr *func = ASTLoweringExpr::translate (expr.get_function_expr ().get ()); + + auto const &in_params = expr.get_params (); std::vector > params; - expr.iterate_params ([&] (AST::Expr *p) mutable -> bool { - auto trans = ASTLoweringExpr::translate (p); - params.push_back (std::unique_ptr (trans)); - return true; - }); + for (auto ¶m : in_params) + { + auto trans = ASTLoweringExpr::translate (param.get ()); + params.push_back (std::unique_ptr (trans)); + } auto crate_num = mappings->get_current_crate (); Analysis::NodeMapping mapping ( @@ -217,12 +219,13 @@ public: HIR::Expr *receiver = ASTLoweringExpr::translate (expr.get_receiver_expr ().get ()); + auto const &in_params = expr.get_params (); std::vector > params; - expr.iterate_params ([&] (AST::Expr *p) mutable -> bool { - auto trans = ASTLoweringExpr::translate (p); - params.push_back (std::unique_ptr (trans)); - return true; - }); + for (auto ¶m : in_params) + { + auto trans = ASTLoweringExpr::translate (param.get ()); + params.push_back (std::unique_ptr (trans)); + } auto crate_num = mappings->get_current_crate (); Analysis::NodeMapping mapping (crate_num, expr.get_node_id (), -- cgit v1.1