mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
compile.c (iseq_build_callinfo_from_hash): hoist out
iseq_build_from_ary_body indentation was too deep for my little terminal, so extract it so it is easier to add keyword support. * compile.c (iseq_build_callinfo_from_hash): hoist out (iseq_build_from_ary_body): shorten callinfo case git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7806df7095
commit
cbf987c857
2 changed files with 31 additions and 19 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Nov 25 10:32:23 2014 Eric Wong <e@80x24.org>
|
||||
|
||||
* compile.c (iseq_build_callinfo_from_hash): hoist out
|
||||
(iseq_build_from_ary_body): shorten callinfo case
|
||||
|
||||
Mon Nov 24 23:03:21 2014 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* gems/bundled_gems: Update to 3.0.7.
|
||||
|
|
45
compile.c
45
compile.c
|
@ -5766,6 +5766,31 @@ iseq_build_load_iseq(rb_iseq_t *iseq, VALUE op)
|
|||
return iseqval;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
iseq_build_callinfo_from_hash(rb_iseq_t *iseq, VALUE op)
|
||||
{
|
||||
ID mid = 0;
|
||||
int orig_argc = 0;
|
||||
VALUE block = 0;
|
||||
unsigned int flag = 0;
|
||||
rb_call_info_kw_arg_t *kw_arg = 0;
|
||||
|
||||
if (!NIL_P(op)) {
|
||||
VALUE vmid = rb_hash_aref(op, ID2SYM(rb_intern("mid")));
|
||||
VALUE vflag = rb_hash_aref(op, ID2SYM(rb_intern("flag")));
|
||||
VALUE vorig_argc = rb_hash_aref(op, ID2SYM(rb_intern("orig_argc")));
|
||||
VALUE vblock = rb_hash_aref(op, ID2SYM(rb_intern("blockptr")));
|
||||
|
||||
if (!NIL_P(vmid)) mid = SYM2ID(vmid);
|
||||
if (!NIL_P(vflag)) flag = NUM2UINT(vflag);
|
||||
if (!NIL_P(vorig_argc)) orig_argc = FIX2INT(vorig_argc);
|
||||
if (!NIL_P(vblock)) block = iseq_build_load_iseq(iseq, vblock);
|
||||
}
|
||||
|
||||
/* TODO: support keywords */
|
||||
|
||||
return (VALUE)new_callinfo(iseq, mid, orig_argc, block, flag, kw_arg);
|
||||
}
|
||||
static int
|
||||
iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
|
||||
VALUE body, struct st_table *labels_table)
|
||||
|
@ -5854,25 +5879,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
|
|||
}
|
||||
break;
|
||||
case TS_CALLINFO:
|
||||
{
|
||||
ID mid = 0;
|
||||
int orig_argc = 0;
|
||||
VALUE block = 0;
|
||||
unsigned int flag = 0;
|
||||
|
||||
if (!NIL_P(op)) {
|
||||
VALUE vmid = rb_hash_aref(op, ID2SYM(rb_intern("mid")));
|
||||
VALUE vflag = rb_hash_aref(op, ID2SYM(rb_intern("flag")));
|
||||
VALUE vorig_argc = rb_hash_aref(op, ID2SYM(rb_intern("orig_argc")));
|
||||
VALUE vblock = rb_hash_aref(op, ID2SYM(rb_intern("blockptr")));
|
||||
|
||||
if (!NIL_P(vmid)) mid = SYM2ID(vmid);
|
||||
if (!NIL_P(vflag)) flag = NUM2UINT(vflag);
|
||||
if (!NIL_P(vorig_argc)) orig_argc = FIX2INT(vorig_argc);
|
||||
if (!NIL_P(vblock)) block = iseq_build_load_iseq(iseq, vblock);
|
||||
}
|
||||
argv[j] = (VALUE)new_callinfo(iseq, mid, orig_argc, block, flag, NULL /* TODO: support keywords */);
|
||||
}
|
||||
argv[j] = iseq_build_callinfo_from_hash(iseq, op);
|
||||
break;
|
||||
case TS_ID:
|
||||
argv[j] = rb_convert_type(op, T_SYMBOL,
|
||||
|
|
Loading…
Reference in a new issue