summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-01 22:14:45 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-01 22:14:45 +0000
commit0b1651753c0ddbad69c20904aa44acf667b8c6ae (patch)
tree9d1d7515e8bd986d63c304be7f5ad5ce9c4caf5d /proc.c
parent72af26207b6e4600e540ec0158cde30df86f7864 (diff)
Revert r33921.
Revert "* proc.c (rb_proc_arity): Fix Proc#arity in case of optional arguments" Because following two reason: * Proc#arity's return value with optional arguments is not clear. The optional argument for proc/lambda is Ruby 1.9 feature. In 1.9, proc(a, b=1){} can receive 1 or more arguments. But lambda(a, b=1){} can receive only 1 or two arguments. r33921 breaks lambda's arity. The spec arround optional arguments of proc/lambda needs more discussion. * No tests. Add tests to test-all. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/proc.c b/proc.c
index 4d9f9baf5a..eeb8f09ae7 100644
--- a/proc.c
+++ b/proc.c
@@ -615,14 +615,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=42|}.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|}.arity #=> -2
+ * Proc.new {|a,*b, c|}.arity #=> -3
*/
static VALUE
@@ -641,7 +641,7 @@ rb_proc_arity(VALUE self)
iseq = proc->block.iseq;
if (iseq) {
if (BUILTIN_TYPE(iseq) != T_NODE) {
- if (iseq->arg_rest < 0 && iseq->arg_opts == 0) {
+ if (iseq->arg_rest < 0) {
return iseq->argc;
}
else {