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`
```
parent ff03a9a6
...@@ -1652,7 +1652,7 @@ RETRY_TRY_BLOCK: ...@@ -1652,7 +1652,7 @@ RETRY_TRY_BLOCK:
switch (GETARG_B(i)) { switch (GETARG_B(i)) {
case OP_R_RETURN: case OP_R_RETURN:
/* Fall through to OP_R_NORMAL otherwise */ /* 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); struct REnv *e = top_env(mrb, proc);
if (!MRB_ENV_STACK_SHARED_P(e)) { if (!MRB_ENV_STACK_SHARED_P(e)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment