diff options
author | M V V S Manoj Kumar <mvvsmanojkumar@gmail.com> | 2022-02-13 08:52:25 +0530 |
---|---|---|
committer | M V V S Manoj Kumar <mvvsmanojkumar@gmail.com> | 2022-02-17 22:11:23 +0530 |
commit | ee4131396ebebf75280fe88a23c2d1778541376c (patch) | |
tree | b3e268e01cf45bc6ab4302439812f207e26d9169 /gcc/rust/hir | |
parent | b71cc52613219f353b054eb5520cd3886f354c10 (diff) | |
download | gcc-ee4131396ebebf75280fe88a23c2d1778541376c.zip gcc-ee4131396ebebf75280fe88a23c2d1778541376c.tar.gz gcc-ee4131396ebebf75280fe88a23c2d1778541376c.tar.bz2 |
Removed Lambda Function within AST::PathPattern
Addresses issue #717
1) Changed the rust-path.h and removed the iterate_path_segments
fuction.
2) Removed the lambda fuction form rust-ast-lower.cc and replaced it
with a for loop.
Signed-off-by : M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r-- | gcc/rust/hir/rust-ast-lower.cc | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/gcc/rust/hir/rust-ast-lower.cc b/gcc/rust/hir/rust-ast-lower.cc index c4db0a3..aac6ee5 100644 --- a/gcc/rust/hir/rust-ast-lower.cc +++ b/gcc/rust/hir/rust-ast-lower.cc @@ -263,17 +263,17 @@ void ASTLowerPathInExpression::visit (AST::PathInExpression &expr) { std::vector<HIR::PathExprSegment> path_segments; - expr.iterate_path_segments ([&] (AST::PathExprSegment &s) mutable -> bool { - path_segments.push_back (lower_path_expr_seg (s)); - - // insert the mappings for the segment - HIR::PathExprSegment *lowered_seg = &path_segments.back (); - mappings->insert_hir_path_expr_seg ( - lowered_seg->get_mappings ().get_crate_num (), - lowered_seg->get_mappings ().get_hirid (), lowered_seg); - return true; - }); + auto &segments = expr.get_segments (); + for (auto &s : segments) + { + path_segments.push_back (lower_path_expr_seg ((s))); + // insert the mappings for the segment + HIR::PathExprSegment *lowered_seg = &path_segments.back (); + mappings->insert_hir_path_expr_seg ( + lowered_seg->get_mappings ().get_crate_num (), + lowered_seg->get_mappings ().get_hirid (), lowered_seg); + } auto crate_num = mappings->get_current_crate (); Analysis::NodeMapping mapping (crate_num, expr.get_node_id (), mappings->get_next_hir_id (crate_num), @@ -311,16 +311,17 @@ ASTLowerQualPathInExpression::visit (AST::QualifiedPathInExpression &expr) = lower_qual_path_type (expr.get_qualified_path_type ()); std::vector<HIR::PathExprSegment> path_segments; - expr.iterate_path_segments ([&] (AST::PathExprSegment &s) mutable -> bool { - path_segments.push_back (lower_path_expr_seg (s)); - - // insert the mappings for the segment - HIR::PathExprSegment *lowered_seg = &path_segments.back (); - mappings->insert_hir_path_expr_seg ( - lowered_seg->get_mappings ().get_crate_num (), - lowered_seg->get_mappings ().get_hirid (), lowered_seg); - return true; - }); + auto &segments = expr.get_segments (); + for (auto &s : segments) + { + path_segments.push_back (lower_path_expr_seg ((s))); + + // insert the mappings for the segment + HIR::PathExprSegment *lowered_seg = &path_segments.back (); + mappings->insert_hir_path_expr_seg ( + lowered_seg->get_mappings ().get_crate_num (), + lowered_seg->get_mappings ().get_hirid (), lowered_seg); + } auto crate_num = mappings->get_current_crate (); Analysis::NodeMapping mapping (crate_num, expr.get_node_id (), |