aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir/rust-ast-lower-expr.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-10-25 13:26:21 +0000
committerGitHub <noreply@github.com>2021-10-25 13:26:21 +0000
commitaefdb4d0365ce9f010be58afee74f81a1777f29f (patch)
tree2559822b214026dff3e706f80bec551bfde33e6c /gcc/rust/hir/rust-ast-lower-expr.h
parent868d3125d326a6800376411fb6699d984cfa7101 (diff)
parent1d3a36276a07a7472ed39499a2c9ddce37146d93 (diff)
downloadgcc-aefdb4d0365ce9f010be58afee74f81a1777f29f.zip
gcc-aefdb4d0365ce9f010be58afee74f81a1777f29f.tar.gz
gcc-aefdb4d0365ce9f010be58afee74f81a1777f29f.tar.bz2
Merge #767
767: gccrs: StructExprStructFields: remove `iterate` method r=philberty a=mathstuf This provides a getter for the set of fields in a struct expression rather than a visitor with a callback which is more complicated for callers, especially static analysis. Signed-off-by: Ben Boeckel <mathstuf@gmail.com> Fixes: #721 Co-authored-by: Ben Boeckel <mathstuf@gmail.com>
Diffstat (limited to 'gcc/rust/hir/rust-ast-lower-expr.h')
-rw-r--r--gcc/rust/hir/rust-ast-lower-expr.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h
index f49839b..782045d 100644
--- a/gcc/rust/hir/rust-ast-lower-expr.h
+++ b/gcc/rust/hir/rust-ast-lower-expr.h
@@ -546,13 +546,14 @@ public:
= new HIR::StructBase (std::unique_ptr<HIR::Expr> (translated_base));
}
+ auto const &in_fields = struct_expr.get_fields ();
std::vector<std::unique_ptr<HIR::StructExprField> > fields;
- struct_expr.iterate ([&] (AST::StructExprField *field) mutable -> bool {
- HIR::StructExprField *translated
- = ASTLowerStructExprField::translate (field);
- fields.push_back (std::unique_ptr<HIR::StructExprField> (translated));
- return true;
- });
+ for (auto &field : in_fields)
+ {
+ HIR::StructExprField *translated
+ = ASTLowerStructExprField::translate (field.get ());
+ fields.push_back (std::unique_ptr<HIR::StructExprField> (translated));
+ }
auto crate_num = mappings->get_current_crate ();
Analysis::NodeMapping mapping (crate_num, struct_expr.get_node_id (),