зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
56b42dec01
Коммит
ead9b197be
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
Wed Jul 12 20:05:23 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* 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.
|
||||
|
||||
Tue Jul 11 20:58:18 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* ruby.h: export rb_cMethod. [ruby-talk:201259]
|
||||
|
||||
Tue Jul 11 19:13:33 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/multi-tk.rb: remove restriction on the class of
|
||||
|
@ -43,6 +58,14 @@ Mon Jul 10 23:37:14 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
the first value from the result array if response has only one
|
||||
value.
|
||||
|
||||
Mon Jul 10 22:00:00 2006 Shigeo Kobayashi <shigek@ruby-lang.org>
|
||||
|
||||
* ext/bigdecimal/bigdecimal.c: Allows '_' to appear within
|
||||
digits. [ruby-dev:28872]
|
||||
|
||||
* ext/bigdecimal/lib/bigdecimal/util.rb: Bug in to_r reported by
|
||||
[ruby-list:42533] fixed.
|
||||
|
||||
Mon Jul 10 19:22:19 2006 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* gc.c (gc_sweep): expand heap earlier.
|
||||
|
|
8
eval.c
8
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 <code>Proc.new</code>.
|
||||
*/
|
||||
|
|
31
parse.y
31
parse.y
|
@ -3941,6 +3941,14 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
|
|||
$$ = dispatch5(params, $1, $3, Qnil, Qnil, escape_Qundef($4));
|
||||
%*/
|
||||
}
|
||||
| f_arg ',' f_optarg ',' f_post_arg opt_f_block_arg
|
||||
{
|
||||
/*%%%*/
|
||||
$$ = new_args($1, $3, 0, $5, $6);
|
||||
/*%
|
||||
$$ = dispatch5(params, $1, $3, Qnil, $5, escape_Qundef($6));
|
||||
%*/
|
||||
}
|
||||
| f_arg ',' f_rest_arg opt_f_block_arg
|
||||
{
|
||||
/*%%%*/
|
||||
|
@ -3989,6 +3997,14 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
|
|||
$$ = dispatch5(params, Qnil, $1, Qnil, Qnil, escape_Qundef($2));
|
||||
%*/
|
||||
}
|
||||
| f_optarg ',' f_post_arg opt_f_block_arg
|
||||
{
|
||||
/*%%%*/
|
||||
$$ = new_args(0, $1, 0, $3, $4);
|
||||
/*%
|
||||
$$ = dispatch5(params, Qnil, $1, Qnil, $3, escape_Qundef($4));
|
||||
%*/
|
||||
}
|
||||
| f_rest_arg opt_f_block_arg
|
||||
{
|
||||
/*%%%*/
|
||||
|
@ -4089,7 +4105,7 @@ f_arg : f_norm_arg
|
|||
VALUE arg = ID2SYM($3);
|
||||
$$ = $1;
|
||||
if (rb_ary_includes($$, arg)) {
|
||||
yyerror("duplicated argument arg");
|
||||
yyerror("duplicated argument name");
|
||||
}
|
||||
rb_ary_push($$, arg);
|
||||
/*%
|
||||
|
@ -7898,9 +7914,18 @@ new_args_gen(struct parser_params *parser, VALUE m, NODE *o, NODE *r, NODE *p, N
|
|||
yyerror("duplicated rest argument name");
|
||||
return 0;
|
||||
}
|
||||
if (p) {
|
||||
r = NEW_POSTARG(r, p);
|
||||
}
|
||||
if (p) {
|
||||
node = p;
|
||||
while (node) {
|
||||
if (!node->nd_head) break;
|
||||
if (arg_dup_check(node->nd_head->nd_vid, m, list, node)) {
|
||||
yyerror("duplicated argument name");
|
||||
return 0;
|
||||
}
|
||||
node = node->nd_next;
|
||||
}
|
||||
r = NEW_POSTARG(r, p);
|
||||
}
|
||||
node = NEW_ARGS(m, o, r);
|
||||
if (b) {
|
||||
|
|
1
ruby.h
1
ruby.h
|
@ -654,6 +654,7 @@ RUBY_EXTERN VALUE rb_cFloat;
|
|||
RUBY_EXTERN VALUE rb_cHash;
|
||||
RUBY_EXTERN VALUE rb_cInteger;
|
||||
RUBY_EXTERN VALUE rb_cIO;
|
||||
RUBY_EXTERN VALUE rb_cMethod;
|
||||
RUBY_EXTERN VALUE rb_cModule;
|
||||
RUBY_EXTERN VALUE rb_cNilClass;
|
||||
RUBY_EXTERN VALUE rb_cNumeric;
|
||||
|
|
Загрузка…
Ссылка в новой задаче