summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--node.c4
-rw-r--r--node.h7
-rw-r--r--parse.y4
4 files changed, 15 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index d421589..03028c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/node.c b/node.c
index cfeb562..d4c2d9b 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 5c08be4..be91a31 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 100f5a0..8ee7cdb 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;