Skip to content
Permalink
Browse files
instance_eval env should remake Fix #3191
  • Loading branch information
ksss committed Aug 8, 2016
1 parent 501e1ef commit ada264a513eabf2f44141a3369ba77576056e0f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
@@ -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_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

0 comments on commit ada264a

Please sign in to comment.