Commit d94469ac authored by kkkkkt's avatar kkkkkt

changed to call check_cv_name_str in check_cv_name_sym and adjust indent

parent 4d72d65d
......@@ -12,7 +12,7 @@
static mrb_value
nil_to_a(mrb_state *mrb, mrb_value obj)
{
return mrb_ary_new(mrb);
return mrb_ary_new(mrb);
}
/*
......@@ -25,7 +25,7 @@ nil_to_a(mrb_state *mrb, mrb_value obj)
static mrb_value
nil_to_f(mrb_state *mrb, mrb_value obj)
{
return mrb_float_value(mrb, 0.0);
return mrb_float_value(mrb, 0.0);
}
/*
......@@ -38,7 +38,7 @@ nil_to_f(mrb_state *mrb, mrb_value obj)
static mrb_value
nil_to_i(mrb_state *mrb, mrb_value obj)
{
return mrb_fixnum_value(0);
return mrb_fixnum_value(0);
}
/*
......
......@@ -1549,18 +1549,6 @@ mod_define_method(mrb_state *mrb, mrb_value self)
return mrb_symbol_value(mid);
}
static void
check_cv_name_sym(mrb_state *mrb, mrb_sym id)
{
const char *s;
mrb_int len;
s = mrb_sym2name_len(mrb, id, &len);
if (len < 3 || !(s[0] == '@' && s[1] == '@')) {
mrb_name_error(mrb, id, "`%S' is not allowed as a class variable name", mrb_sym2str(mrb, id));
}
}
static void
check_cv_name_str(mrb_state *mrb, mrb_value str)
{
......@@ -1572,6 +1560,12 @@ check_cv_name_str(mrb_state *mrb, mrb_value str)
}
}
static void
check_cv_name_sym(mrb_state *mrb, mrb_sym id)
{
check_cv_name_str(mrb, mrb_sym2str(mrb, id));
}
static mrb_value
get_sym_or_str_arg(mrb_state *mrb)
{
......
......@@ -113,34 +113,34 @@ mrb_obj_id(mrb_value obj)
#define MakeID(p) MakeID2(p,tt)
switch (tt) {
case MRB_TT_FREE:
case MRB_TT_UNDEF:
case MRB_TT_FREE:
case MRB_TT_UNDEF:
return MakeID(0); /* not define */
case MRB_TT_FALSE:
case MRB_TT_FALSE:
if (mrb_nil_p(obj))
return MakeID(1);
return MakeID(0);
case MRB_TT_TRUE:
case MRB_TT_TRUE:
return MakeID(1);
case MRB_TT_SYMBOL:
case MRB_TT_SYMBOL:
return MakeID(mrb_symbol(obj));
case MRB_TT_FIXNUM:
case MRB_TT_FIXNUM:
return MakeID2(mrb_float_id((mrb_float)mrb_fixnum(obj)), MRB_TT_FLOAT);
case MRB_TT_FLOAT:
case MRB_TT_FLOAT:
return MakeID(mrb_float_id(mrb_float(obj)));
case MRB_TT_STRING:
case MRB_TT_OBJECT:
case MRB_TT_CLASS:
case MRB_TT_MODULE:
case MRB_TT_ICLASS:
case MRB_TT_SCLASS:
case MRB_TT_PROC:
case MRB_TT_ARRAY:
case MRB_TT_HASH:
case MRB_TT_RANGE:
case MRB_TT_EXCEPTION:
case MRB_TT_FILE:
case MRB_TT_DATA:
case MRB_TT_STRING:
case MRB_TT_OBJECT:
case MRB_TT_CLASS:
case MRB_TT_MODULE:
case MRB_TT_ICLASS:
case MRB_TT_SCLASS:
case MRB_TT_PROC:
case MRB_TT_ARRAY:
case MRB_TT_HASH:
case MRB_TT_RANGE:
case MRB_TT_EXCEPTION:
case MRB_TT_FILE:
case MRB_TT_DATA:
default:
return MakeID(mrb_ptr(obj));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment