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:
Yukihiro "Matz" Matsumoto
2017-02-11 21:21:19 +09:00
parent ff03a9a61c
commit 1f2d786e32
+1 -1
View File
@@ -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)) {