diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-04-29 14:37:44 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-04-30 13:31:12 +0100 |
commit | 7e576d70b6a1065bf31c37380a8e39354d961cd6 (patch) | |
tree | ff98b21d8e1560e37661a91ddd286001cb13a44c /gcc/rust/backend/rust-compile-expr.cc | |
parent | 44c058c30dd1d36f87c36f2c487355a5736d0afc (diff) | |
download | gcc-7e576d70b6a1065bf31c37380a8e39354d961cd6.zip gcc-7e576d70b6a1065bf31c37380a8e39354d961cd6.tar.gz gcc-7e576d70b6a1065bf31c37380a8e39354d961cd6.tar.bz2 |
Support recursive coercion sites
Our code for coercion sites are handled in two places once where we do the
type-checking portion and one where we do the code-generation. This makes
the code-generation piece recursive so that we apply the behaviours
consistantly when types need checked or converted.
Fixes #1146
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 5f9334c..4225263 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -677,17 +677,6 @@ CompileExpr::compile_dyn_dispatch_call (const TyTy::DynamicObjectType *dyn, = ctx->get_backend ()->convert_expression (expected_fntype, fn_vtable_access, expr_locus); - fncontext fnctx = ctx->peek_fn (); - tree enclosing_scope = ctx->peek_enclosing_scope (); - bool is_address_taken = false; - tree ret_var_stmt = NULL_TREE; - Bvariable *fn_convert_expr_tmp - = ctx->get_backend ()->temporary_variable (fnctx.fndecl, enclosing_scope, - expected_fntype, fn_convert_expr, - is_address_taken, expr_locus, - &ret_var_stmt); - ctx->add_statement (ret_var_stmt); - std::vector<tree> args; args.push_back (self_argument); for (auto &argument : arguments) @@ -696,10 +685,7 @@ CompileExpr::compile_dyn_dispatch_call (const TyTy::DynamicObjectType *dyn, args.push_back (compiled_expr); } - tree fn_expr - = ctx->get_backend ()->var_expression (fn_convert_expr_tmp, expr_locus); - - return ctx->get_backend ()->call_expression (fn_expr, args, nullptr, + return ctx->get_backend ()->call_expression (fn_convert_expr, args, nullptr, expr_locus); } |