aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir
diff options
context:
space:
mode:
authorNirmal Patel <npate012@gmail.com>2021-10-28 13:58:03 -0400
committerNirmal Patel <npate012@gmail.com>2021-10-28 13:58:03 -0400
commit08b83163db07c903a6524f15f9adce4a0e7fa359 (patch)
tree22cc4400519d1b4826596dceb1faf6cb07520fc8 /gcc/rust/hir
parente28c43f2f40cf405e89b3892aa65f6a06fa1c802 (diff)
downloadgcc-08b83163db07c903a6524f15f9adce4a0e7fa359.zip
gcc-08b83163db07c903a6524f15f9adce4a0e7fa359.tar.gz
gcc-08b83163db07c903a6524f15f9adce4a0e7fa359.tar.bz2
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 <npate012@gmail.com>
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r--gcc/rust/hir/rust-ast-lower-expr.h23
1 files changed, 13 insertions, 10 deletions
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<std::unique_ptr<HIR::Expr> > params;
- expr.iterate_params ([&] (AST::Expr *p) mutable -> bool {
- auto trans = ASTLoweringExpr::translate (p);
- params.push_back (std::unique_ptr<HIR::Expr> (trans));
- return true;
- });
+ for (auto &param : in_params)
+ {
+ auto trans = ASTLoweringExpr::translate (param.get ());
+ params.push_back (std::unique_ptr<HIR::Expr> (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<std::unique_ptr<HIR::Expr> > params;
- expr.iterate_params ([&] (AST::Expr *p) mutable -> bool {
- auto trans = ASTLoweringExpr::translate (p);
- params.push_back (std::unique_ptr<HIR::Expr> (trans));
- return true;
- });
+ for (auto &param : in_params)
+ {
+ auto trans = ASTLoweringExpr::translate (param.get ());
+ params.push_back (std::unique_ptr<HIR::Expr> (trans));
+ }
auto crate_num = mappings->get_current_crate ();
Analysis::NodeMapping mapping (crate_num, expr.get_node_id (),