1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* node.h (rb_args_info): change pre_args_num and post_args_num as

int, to match with rb_iseq_t.
* parse.y (new_args_gen): check overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-12-27 12:17:36 +00:00
parent c5e372ff27
commit 731e45216a
4 changed files with 15 additions and 7 deletions

View file

@ -1,3 +1,10 @@
Tue Dec 27 21:17:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* node.h (rb_args_info): change pre_args_num and post_args_num as
int, to match with rb_iseq_t.
* parse.y (new_args_gen): check overflow.
Mon Dec 26 22:38:35 2011 Yusuke Endoh <mame@tsg.ne.jp>
* vm_insnhelper.c (unknown_keyword_error): make it kind a error

4
node.c
View file

@ -850,9 +850,9 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("method parameters");
ANN("format: def method_name(.., [nd_opt=some], *[nd_rest], [nd_pid], .., &[nd_body])");
ANN("example: def foo(a, b, opt1=1, opt2=2, *rest, y, z, &blk); end");
F_LONG(nd_ainfo->pre_args_num, "count of mandatory (pre-)arguments");
F_INT(nd_ainfo->pre_args_num, "count of mandatory (pre-)arguments");
F_NODE(nd_ainfo->pre_init, "initialization of (pre-)arguments");
F_LONG(nd_ainfo->post_args_num, "count of mandatory post-arguments");
F_INT(nd_ainfo->post_args_num, "count of mandatory post-arguments");
F_NODE(nd_ainfo->post_init, "initialization of post-arguments");
F_ID(nd_ainfo->first_post_arg, "first post argument");
F_ID(nd_ainfo->rest_arg, "rest argument");

7
node.h
View file

@ -488,11 +488,12 @@ VALUE rb_gvar_defined(struct rb_global_entry *);
const struct kwtable *rb_reserved_word(const char *, unsigned int);
struct rb_args_info {
long pre_args_num; /* count of mandatory pre-arguments */
NODE *pre_init;
long post_args_num; /* count of mandatory post-arguments */
NODE *post_init;
int pre_args_num; /* count of mandatory pre-arguments */
int post_args_num; /* count of mandatory post-arguments */
ID first_post_arg;
ID rest_arg;

View file

@ -9656,10 +9656,10 @@ new_args_gen(struct parser_params *parser, NODE *m, NODE *o, ID r, NODE *p, NODE
args = ALLOC(struct rb_args_info);
args->pre_args_num = m ? m->nd_plen : 0;
args->pre_args_num = m ? rb_long2int(m->nd_plen) : 0;
args->pre_init = m ? m->nd_next : 0;
args->post_args_num = p ? p->nd_plen : 0;
args->post_args_num = p ? rb_long2int(p->nd_plen) : 0;
args->post_init = p ? p->nd_next : 0;
args->first_post_arg = p ? p->nd_pid : 0;