Commit 1efb1bba authored by Masaki Muranaka's avatar Masaki Muranaka

Use mrb_name_error() as possible.

parent 2f829ea0
......@@ -125,7 +125,7 @@ mrb_struct_getmember(mrb_state *mrb, mrb_value obj, mrb_sym id)
return ptr[i];
}
}
mrb_raisef(mrb, E_NAME_ERROR, "%S is not struct member", mrb_sym2str(mrb, id));
mrb_name_error(mrb, id, "%S is not struct member", mrb_sym2str(mrb, id));
return mrb_nil_value(); /* not reached */
}
......@@ -204,7 +204,7 @@ mrb_struct_set(mrb_state *mrb, mrb_value obj, mrb_value val)
return ptr[i] = val;
}
}
mrb_raisef(mrb, E_NAME_ERROR, "`%S' is not a struct member",
mrb_name_error(mrb, mid, "`%S' is not a struct member",
mrb_sym2str(mrb, mid));
return mrb_nil_value(); /* not reached */
}
......@@ -249,7 +249,7 @@ make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass * k
name = mrb_str_to_str(mrb, name);
id = mrb_to_id(mrb, name);
if (!mrb_is_const_id(id)) {
mrb_raisef(mrb, E_NAME_ERROR, "identifier %S needs to be constant", name);
mrb_name_error(mrb, id, "identifier %S needs to be constant", name);
}
if (mrb_const_defined_at(mrb, klass, id)) {
mrb_warn("redefining constant Struct::%s", mrb_string_value_ptr(mrb, name));
......@@ -544,7 +544,7 @@ mrb_struct_aref_id(mrb_state *mrb, mrb_value s, mrb_sym id)
return ptr[i];
}
}
mrb_raisef(mrb, E_NAME_ERROR, "no member '%S' in struct", mrb_sym2str(mrb, id));
mrb_name_error(mrb, id, "no member '%S' in struct", mrb_sym2str(mrb, id));
return mrb_nil_value(); /* not reached */
}
......@@ -619,7 +619,7 @@ mrb_struct_aset_id(mrb_state *mrb, mrb_value s, mrb_sym id, mrb_value val)
return val;
}
}
mrb_raisef(mrb, E_NAME_ERROR, "no member '%S' in struct", mrb_sym2str(mrb, id));
mrb_name_error(mrb, id, "no member '%S' in struct", mrb_sym2str(mrb, id));
return val; /* not reach */
}
......
......@@ -979,7 +979,7 @@ mrb_method_search(mrb_state *mrb, struct RClass* c, mrb_sym mid)
if (RSTRING_LEN(inspect) > 64) {
inspect = mrb_any_to_s(mrb, mrb_obj_value(c));
}
mrb_raisef(mrb, E_NAME_ERROR, "undefined method '%S' for class %S",
mrb_name_error(mrb, mid, "undefined method '%S' for class %S",
mrb_sym2str(mrb, mid), inspect);
}
return m;
......
......@@ -691,7 +691,7 @@ mrb_mod_cv_get(mrb_state *mrb, struct RClass * c, mrb_sym sym)
}
c = c->super;
}
mrb_raisef(mrb, E_NAME_ERROR, "uninitialized class variable %S in %S",
mrb_name_error(mrb, sym, "uninitialized class variable %S in %S",
mrb_sym2str(mrb, sym), cls);
/* not reached */
return mrb_nil_value();
......@@ -847,7 +847,7 @@ L_RETRY:
}
c = c->super;
}
mrb_raisef(mrb, E_NAME_ERROR, "uninitialized constant %S",
mrb_name_error(mrb, sym, "uninitialized constant %S",
mrb_sym2str(mrb, sym));
/* not reached */
return mrb_nil_value();
......
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