From 731e45216ae4adf4122f0515d3056e1579efb0f9 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 27 Dec 2011 12:17:36 +0000 Subject: [PATCH] * 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 --- ChangeLog | 7 +++++++ node.c | 4 ++-- node.h | 7 ++++--- parse.y | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index d421589c8f7423..03028c289ae82e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Dec 27 21:17:33 2011 Nobuyoshi Nakada + + * 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 * vm_insnhelper.c (unknown_keyword_error): make it kind a error diff --git a/node.c b/node.c index cfeb5629521da4..d4c2d9b02c001e 100644 --- a/node.c +++ b/node.c @@ -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"); diff --git a/node.h b/node.h index 5c08be4ab5b1dc..be91a312b87552 100644 --- a/node.h +++ b/node.h @@ -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; diff --git a/parse.y b/parse.y index 100f5a0847fc1b..8ee7cdb6107b5c 100644 --- a/parse.y +++ b/parse.y @@ -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;