Unverified Commit 55dcdd26 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4039 from i110/i110/fix-broken-lexical-variables

fix broken lexical variables
parents 77850056 1dbeda5c
...@@ -99,3 +99,19 @@ assert('Object#instance_eval with begin-rescue-ensure execution order') do ...@@ -99,3 +99,19 @@ assert('Object#instance_eval with begin-rescue-ensure execution order') do
hell_raiser = HellRaiser.new hell_raiser = HellRaiser.new
assert_equal([:enter_raise_hell, :begin, :rescue, :ensure], hell_raiser.raise_hell) assert_equal([:enter_raise_hell, :begin, :rescue, :ensure], hell_raiser.raise_hell)
end end
assert('Kernel.#eval(strinng) Issue #4021') do
assert_equal('FOO') { (eval <<'EOS').call }
foo = "FOO"
Proc.new { foo }
EOS
assert_equal('FOO') {
def do_eval(code)
eval(code)
end
do_eval(<<'EOS').call
foo = "FOO"
Proc.new { foo }
EOS
}
end
...@@ -528,8 +528,6 @@ mrb_exec_irep(mrb_state *mrb, mrb_value self, struct RProc *p) ...@@ -528,8 +528,6 @@ mrb_exec_irep(mrb_state *mrb, mrb_value self, struct RProc *p)
return MRB_PROC_CFUNC(p)(mrb, self); return MRB_PROC_CFUNC(p)(mrb, self);
} }
ci->nregs = p->body.irep->nregs; ci->nregs = p->body.irep->nregs;
ci->env = MRB_PROC_ENV(p);
if (ci->env) ci->env->stack[0] = self;
if (ci->argc < 0) keep = 3; if (ci->argc < 0) keep = 3;
else keep = ci->argc + 2; else keep = ci->argc + 2;
if (ci->nregs < keep) { if (ci->nregs < keep) {
......
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