1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm_insnhelper.c: refinements with send

* vm_insnhelper.c (vm_call_opt_send): enable refinements with
  Kernel#send and BasicObject#__send__.  [Feature #11476]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-10-19 08:02:17 +00:00
parent 79d49d1a70
commit c8fee08a3d
3 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Wed Oct 19 17:02:15 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_insnhelper.c (vm_call_opt_send): enable refinements with
Kernel#send and BasicObject#__send__. [Feature #11476]
Wed Oct 19 14:22:49 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* basictest/runner.rb: do not clobber the option by --run-opt with

View file

@ -171,10 +171,10 @@ class TestRefinement < Test::Unit::TestCase
end
end
def test_send_should_not_use_refinements
def test_send_should_use_refinements
foo = Foo.new
assert_raise(NoMethodError) { foo.send(:z) }
assert_raise(NoMethodError) { FooExtClient.send_z_on(foo) }
assert_equal("FooExt#z", FooExtClient.send_z_on(foo))
assert_raise(NoMethodError) { foo.send(:z) }
assert_equal(true, RespondTo::Sub.new.respond_to?(:foo))

View file

@ -1956,7 +1956,7 @@ vm_call_opt_send(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_calling
DEC_SP(1);
}
cc->me = rb_callable_method_entry_without_refinements(CLASS_OF(calling->recv), ci->mid);
cc->me = rb_callable_method_entry_with_refinements(CLASS_OF(calling->recv), ci->mid);
ci->flag = VM_CALL_FCALL | VM_CALL_OPT_SEND;
return vm_call_method(th, reg_cfp, calling, ci, cc);
}