diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-24 13:50:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-24 13:50:44 +0000 |
commit | c87f2c72dcfa67f1a78fafacaf49043f11c7df6a (patch) | |
tree | 02daa3d23d04cb9c950b15d5a7a94f171e1241db /gcc/rust/backend/rust-compile-item.h | |
parent | 23e748d7a6855ce132299cfef9692ee9c681de59 (diff) | |
parent | 92a434a33904608f5659cf7b5d4df3d2a99bd5bd (diff) | |
download | gcc-c87f2c72dcfa67f1a78fafacaf49043f11c7df6a.zip gcc-c87f2c72dcfa67f1a78fafacaf49043f11c7df6a.tar.gz gcc-c87f2c72dcfa67f1a78fafacaf49043f11c7df6a.tar.bz2 |
Merge #523
523: Add support for nested functions r=philberty a=philberty
This is a missed pieces of functionality for statements in rust.
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-item.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index 8a521e7..eacfda9 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -213,26 +213,10 @@ public: } std::vector<Bvariable *> locals; - rib->iterate_decls ([&] (NodeId n, Location) mutable -> bool { - Resolver::Definition d; - bool ok = ctx->get_resolver ()->lookup_definition (n, &d); - rust_assert (ok); - - HIR::Stmt *decl = nullptr; - ok = ctx->get_mappings ()->resolve_nodeid_to_stmt (d.parent, &decl); - rust_assert (ok); - - Bvariable *compiled = CompileVarDecl::compile (fndecl, decl, ctx); - locals.push_back (compiled); - - return true; - }); - - bool toplevel_item - = function.get_mappings ().get_local_defid () != UNKNOWN_LOCAL_DEFID; - Bblock *enclosing_scope - = toplevel_item ? NULL : ctx->peek_enclosing_scope (); + bool ok = compile_locals_for_block (*rib, fndecl, locals); + rust_assert (ok); + Bblock *enclosing_scope = NULL; HIR::BlockExpr *function_body = function.get_definition ().get (); Location start_location = function_body->get_locus (); Location end_location = function_body->get_closing_locus (); |