summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-20 01:23:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-20 01:23:02 +0000
commit7190c04417a52c29d1dcf6b2f04bb55b30cbfd9f (patch)
tree3b2ddfd7c895c702f13b175494c67b978be7ae58 /compile.c
parent341376215b58407d6764240d9b9ebe67a9c82170 (diff)
compile.c: store IDs as Symbols
* compile.c (iseq_set_arguments): store local variable IDs in temporary list as Symbols. previously these are stored as Fixnums to prevent from GC, but IDs of dynamic symbols can exceed Fixnum range and cause RangeError at inverting from Fixnum. [ruby-dev:48564] [Bug #10266] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index ac4e5ba..93f0603 100644
--- a/compile.c
+++ b/compile.c
@@ -1237,7 +1237,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
if (!required) required = rb_ary_tmp_new(1);
list = required;
}
- rb_ary_push(list, INT2FIX(node->nd_body->nd_vid));
+ rb_ary_push(list, ID2SYM(node->nd_body->nd_vid));
COMPILE_POPED(optargs, "kwarg", node); /* nd_type(node) == NODE_KW_ARG */
node = node->nd_next;
i += 1;
@@ -1251,7 +1251,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
keywords = required;
}
for (j = 0; j < i; j++) {
- iseq->arg_keyword_table[j] = FIX2INT(RARRAY_AREF(keywords, j));
+ iseq->arg_keyword_table[j] = SYM2ID(RARRAY_AREF(keywords, j));
}
ADD_INSN(optargs, nd_line(args->kw_args), pop);
}