summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-26 07:23:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-26 07:23:23 +0000
commit6b818dd9616ce6f0c849ab32c5869cc55b624b0a (patch)
tree57a01309af17a79bcf3f47f2bb95cf135fa955ca /compile.c
parent7e3bd6646ca88a285f0eb369a668c6596e0d6c83 (diff)
common conversion functions
* array.c (rb_to_array_type): make public to share common code internally. * hash.c (rb_to_hash_type): make public to share common code internally. * symbol.c (rb_to_symbol_type): make public to share common code internally. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/compile.c b/compile.c
index 0d977fbebc..b3969ff4c4 100644
--- a/compile.c
+++ b/compile.c
@@ -7058,7 +7058,7 @@ register_label(rb_iseq_t *iseq, struct st_table *labels_table, VALUE obj)
{
LABEL *label = 0;
st_data_t tmp;
- obj = rb_convert_type_with_id(obj, T_SYMBOL, "Symbol", idTo_sym);
+ obj = rb_to_symbol_type(obj);
if (st_lookup(labels_table, obj, &tmp) == 0) {
label = NEW_LABEL(0);
@@ -7111,8 +7111,7 @@ iseq_build_from_ary_exception(rb_iseq_t *iseq, struct st_table *labels_table,
LABEL *lstart, *lend, *lcont;
unsigned int sp;
- v = rb_convert_type_with_id(RARRAY_AREF(exception, i), T_ARRAY,
- "Array", idTo_ary);
+ v = rb_to_array_type(RARRAY_AREF(exception, i));
if (RARRAY_LEN(v) != 6) {
rb_raise(rb_eSyntaxError, "wrong exception entry");
}
@@ -7300,7 +7299,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
}
break;
case TS_GENTRY:
- op = rb_convert_type_with_id(op, T_SYMBOL, "Symbol", idTo_sym);
+ op = rb_to_symbol_type(op);
argv[j] = (VALUE)rb_global_entry(SYM2ID(op));
break;
case TS_IC:
@@ -7316,8 +7315,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
argv[j] = Qfalse;
break;
case TS_ID:
- argv[j] = rb_convert_type_with_id(op, T_SYMBOL,
- "Symbol", idTo_sym);
+ argv[j] = rb_to_symbol_type(op);
break;
case TS_CDHASH:
{
@@ -7325,7 +7323,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
VALUE map = rb_hash_new_with_size(RARRAY_LEN(op)/2);
rb_hash_tbl_raw(map)->type = &cdhash_type;
- op = rb_convert_type_with_id(op, T_ARRAY, "Array", idTo_ary);
+ op = rb_to_array_type(op);
for (i=0; i<RARRAY_LEN(op); i+=2) {
VALUE key = RARRAY_AREF(op, i);
VALUE sym = RARRAY_AREF(op, i+1);
@@ -7367,8 +7365,8 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
return iseq_setup(iseq, anchor);
}
-#define CHECK_ARRAY(v) rb_convert_type_with_id((v), T_ARRAY, "Array", idTo_ary)
-#define CHECK_SYMBOL(v) rb_convert_type_with_id((v), T_SYMBOL, "Symbol", idTo_sym)
+#define CHECK_ARRAY(v) rb_to_array_type(v)
+#define CHECK_SYMBOL(v) rb_to_symbol_type(v)
static int
int_param(int *dst, VALUE param, VALUE sym)