Skip to content

Commit

Permalink
* node.h (rb_args_info): change pre_args_num and post_args_num as
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
nobu committed Dec 27, 2011
1 parent c5e372f commit 731e452
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Tue Dec 27 21:17:33 2011 Nobuyoshi Nakada <[email protected]>

* 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 <[email protected]>

* vm_insnhelper.c (unknown_keyword_error): make it kind a error
Expand Down
4 changes: 2 additions & 2 deletions node.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
7 changes: 4 additions & 3 deletions node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 731e452

Please sign in to comment.