From ead9b197be96f9eacf462b5539f71c43422495d0 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 12 Jul 2006 11:10:22 +0000 Subject: * parse.y (f_args): allow post mandatory arguments after optional arguments. [ruby-dev:29014] * parse.y (new_args_gen): allow post_args without rest_args. * eval.c (formal_assign): ditto. * parse.y (new_args_gen): check post argument duplication. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index ad976f4c2e..acd1840be9 100644 --- a/eval.c +++ b/eval.c @@ -244,7 +244,7 @@ static void rb_f_END(void); static struct BLOCK *passing_block(VALUE,struct BLOCK*); static int block_orphan(struct BLOCK *data); -static VALUE rb_cMethod; +VALUE rb_cMethod; static VALUE rb_cUnboundMethod; static VALUE umethod_bind(VALUE, VALUE); static VALUE rb_mod_define_method(int, VALUE*, VALUE); @@ -5131,7 +5131,7 @@ assign(VALUE self, NODE *lhs, VALUE val, int pcall) int cnt; VALUE *p; - if ((long)(lhs->nd_args) != -1) { + if (lhs->nd_args && (long)(lhs->nd_args) != -1) { assign(self, lhs->nd_args, val, 0); } cnt = lhs->nd_head->nd_alen; @@ -5660,7 +5660,7 @@ formal_assign(VALUE recv, NODE *node, int argc, const VALUE *argv, VALUE *local_ NODE *opt = node->nd_opt; int ac = argc - npost; - while (opt && ac) { + while (opt && ac > 0) { assign(recv, opt->nd_head, *argv, 1); argv++; ac--; ++i; @@ -8372,7 +8372,7 @@ proc_s_new(int argc, VALUE *argv, VALUE klass) /* * call-seq: - * proc { |...| block } => a_proc + * proc {|...| block } => a_proc * * Equivalent to Proc.new. */ -- cgit v1.2.3