mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Avoid direct return from ecall(); fix #3441
There's incompatibility left for mruby. When you return from `ensure` clause, mruby simply ignores the return value. CRuby returns from the method squashing the exception raised. ``` def f no_such_method() # NoMethodError ensure return 22 end p f() # CRuby prints `22` ```
This commit is contained in:
@@ -1652,7 +1652,7 @@ RETRY_TRY_BLOCK:
|
||||
switch (GETARG_B(i)) {
|
||||
case OP_R_RETURN:
|
||||
/* Fall through to OP_R_NORMAL otherwise */
|
||||
if (proc->env && !MRB_PROC_STRICT_P(proc)) {
|
||||
if (ci->acc >=0 && proc->env && !MRB_PROC_STRICT_P(proc)) {
|
||||
struct REnv *e = top_env(mrb, proc);
|
||||
|
||||
if (!MRB_ENV_STACK_SHARED_P(e)) {
|
||||
|
||||
Reference in New Issue
Block a user