mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
instance_eval env should remake Fix #3191
This commit is contained in:
@@ -247,6 +247,7 @@ f_instance_eval(mrb_state *mrb, mrb_value self)
|
||||
cv = mrb_singleton_class(mrb, self);
|
||||
c->ci->target_class = mrb_class_ptr(cv);
|
||||
proc = create_proc_from_string(mrb, s, len, mrb_nil_value(), file, line);
|
||||
mrb->c->ci->env = NULL;
|
||||
return mrb_vm_run(mrb, proc, mrb->c->stack[0], 0);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -64,6 +64,8 @@ assert('String instance_eval') do
|
||||
assert_equal(['test.rb', 10]) { obj.instance_eval('[__FILE__, __LINE__]', 'test.rb', 10)}
|
||||
assert_equal('test') { obj.instance_eval('@test') }
|
||||
assert_equal('test') { obj.instance_eval { @test } }
|
||||
o = Object.new
|
||||
assert_equal ['', o, o], o.instance_eval("[''].each { |s| break [s, o, self] }")
|
||||
end
|
||||
|
||||
assert('Kernel.#eval(string) context') do
|
||||
|
||||
Reference in New Issue
Block a user