* vm_insnhelper.c (vm_call_method): ensure methods of type

VM_METHOD_TYPE_ATTR_SET are called with 1 argument

* test/ruby/test_module.rb (class TestModule): add test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
charliesome 2013-06-18 14:01:32 +00:00
Родитель 0a3f79310f
Коммит 65dc35a582
3 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Tue Jun 18 22:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* vm_insnhelper.c (vm_call_method): ensure methods of type
VM_METHOD_TYPE_ATTR_SET are called with 1 argument
* test/ruby/test_module.rb (class TestModule): add test
[ruby-core:55543] [Bug #8540]
Tue Jun 18 22:36:23 2013 Masaya Tarui <tarui@ruby-lang.org>
* gc.c (gc_profile_record_flag): reason seems like one-hot encoding.

Просмотреть файл

@ -1167,6 +1167,14 @@ class TestModule < Test::Unit::TestCase
assert_equal(1, c.x, bug3406)
end
def test_attr_writer_with_no_arguments
bug8540 = "[ruby-core:55543]"
c = Class.new do
attr_writer :foo
end
assert_raise(ArgumentError) { c.new.send :foo= }
end
def test_private_constant
c = Class.new
c.const_set(:FOO, "foo")

Просмотреть файл

@ -1773,7 +1773,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
CI_SET_FASTPATH(ci, vm_call_cfunc, enable_fastpath);
return vm_call_cfunc(th, cfp, ci);
case VM_METHOD_TYPE_ATTRSET:{
rb_check_arity(ci->argc, 0, 1);
rb_check_arity(ci->argc, 1, 1);
ci->aux.index = 0;
CI_SET_FASTPATH(ci, vm_call_attrset, enable_fastpath && !(ci->flag & VM_CALL_ARGS_SPLAT));
return vm_call_attrset(th, cfp, ci);