diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-02-11 21:21:19 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-02-11 21:58:47 +0900 |
| commit | 1f2d786e3220ecb6b3ff95e31f538ce338374c54 (patch) | |
| tree | 4941d5c44d98ae3c727647ee84ec283ff5657106 /src/vm.c | |
| parent | ff03a9a61c62340cff62f8e0fdc1a1e8775b6f17 (diff) | |
| download | mruby-1f2d786e3220ecb6b3ff95e31f538ce338374c54.tar.gz mruby-1f2d786e3220ecb6b3ff95e31f538ce338374c54.zip | |
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`
```
Diffstat (limited to 'src/vm.c')
| -rw-r--r-- | src/vm.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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)) { |
