diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-14 21:10:34 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-14 21:10:34 +0000 |
commit | 7316302483182a73136b00ad368585e551cbd86f (patch) | |
tree | d32188711001581a5e7e21d6669f6c4e91fcb497 /proc.c | |
parent | 35c356ea72094dbbf1397d8f5acd065bd23d1177 (diff) | |
download | ruby-7316302483182a73136b00ad368585e551cbd86f.tar.gz |
* include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]
* array.c: Use rb_check_arity / rb_error_arity
* class.c: ditto
* enumerator.c: ditto
* eval.c: ditto
* file.c: ditto
* hash.c: ditto
* numeric.c: ditto
* proc.c: ditto
* process.c: ditto
* random.c: ditto
* re.c: ditto
* signal.c: ditto
* string.c: ditto
* struct.c: ditto
* transcode.c: ditto
* vm_eval.c: ditto
* vm_insnhelper.c: ditto & implementation of rb_error_arity
* test/ruby/test_arity.rb: tests for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1350,7 +1350,8 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod) id = rb_to_id(argv[0]); body = rb_block_lambda(); } - else if (argc == 2) { + else { + rb_check_arity(argc, 1, 2); id = rb_to_id(argv[0]); body = argv[1]; if (!rb_obj_is_method(body) && !rb_obj_is_proc(body)) { @@ -1359,9 +1360,6 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod) rb_obj_classname(body)); } } - else { - rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc); - } if (rb_obj_is_method(body)) { struct METHOD *method = (struct METHOD *)DATA_PTR(body); |