diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-16 15:19:03 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-16 15:19:03 +0000 |
commit | 466f7f6c81fe36bed2c2359f0577c67492d82fd4 (patch) | |
tree | f485bc24c58895663dee65876b0bf188a25d75d4 /proc.c | |
parent | fae19d62290763330d5b489dbc5d360c45be1ad7 (diff) | |
download | bundler-466f7f6c81fe36bed2c2359f0577c67492d82fd4.tar.gz |
Revert r33924.
* proc.c (rb_proc_arity): Fix Proc#arity in case of optional arguments
[bug #5694] [rubyspec:b8b259] [rubyspec:184c8100f]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -622,14 +622,14 @@ rb_proc_call_with_block(VALUE self, int argc, VALUE *argv, VALUE pass_procval) * arguments. A <code>proc</code> with no argument declarations * is the same a block declaring <code>||</code> as its arguments. * - * Proc.new {}.arity #=> 0 - * Proc.new {||}.arity #=> 0 - * Proc.new {|a|}.arity #=> 1 - * Proc.new {|a,b|}.arity #=> 2 - * Proc.new {|a,b,c|}.arity #=> 3 - * Proc.new {|*a|}.arity #=> -1 - * Proc.new {|a,*b|}.arity #=> -2 - * Proc.new {|a,*b, c|}.arity #=> -3 + * Proc.new {}.arity #=> 0 + * Proc.new {||}.arity #=> 0 + * Proc.new {|a|}.arity #=> 1 + * Proc.new {|a, b|}.arity #=> 2 + * Proc.new {|a, b, c|}.arity #=> 3 + * Proc.new {|*a|}.arity #=> -1 + * Proc.new {|a, b=42|}.arity #=> -2 + * Proc.new {|a, *b, c|}.arity #=> -3 */ static VALUE @@ -648,7 +648,7 @@ rb_proc_arity(VALUE self) iseq = proc->block.iseq; if (iseq) { if (BUILTIN_TYPE(iseq) != T_NODE) { - if (iseq->arg_rest < 0) { + if (iseq->arg_rest < 0 && iseq->arg_opts == 0) { return iseq->argc; } else { |