Commit 444e4b79 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2538 from kkkkkt/refactor-method

refactor mruby method(fix indent. remove temporary value etc)
parents 98a95530 2f1d12c7
......@@ -1104,5 +1104,5 @@ mrb_init_array(mrb_state *mrb)
mrb_define_method(mrb, a, "unshift", mrb_ary_unshift_m, MRB_ARGS_ANY()); /* 15.2.12.5.30 */
mrb_define_method(mrb, a, "__ary_eq", mrb_ary_eq, MRB_ARGS_REQ(1));
mrb_define_method(mrb, a, "__ary_cmp", mrb_ary_cmp, MRB_ARGS_REQ(1));
mrb_define_method(mrb, a, "__ary_cmp", mrb_ary_cmp, MRB_ARGS_REQ(1));
}
......@@ -746,10 +746,10 @@ gen_values(codegen_scope *s, node *t, int val)
codegen(s, t->car, VAL);
pop(); pop();
if (is_splat) {
genop(s, MKOP_AB(OP_ARYCAT, cursp(), cursp()+1));
genop(s, MKOP_AB(OP_ARYCAT, cursp(), cursp()+1));
}
else {
genop(s, MKOP_AB(OP_ARYPUSH, cursp(), cursp()+1));
genop(s, MKOP_AB(OP_ARYPUSH, cursp(), cursp()+1));
}
t = t->cdr;
while (t) {
......
......@@ -738,9 +738,8 @@ static mrb_value
mrb_obj_methods(mrb_state *mrb, mrb_bool recur, mrb_value obj, mrb_method_flag_t flag)
{
if (recur)
return mrb_class_instance_method_list(mrb, recur, mrb_class(mrb, obj), 0);
else
return mrb_obj_singleton_methods(mrb, recur, obj);
return mrb_class_instance_method_list(mrb, recur, mrb_class(mrb, obj), 0);
return mrb_obj_singleton_methods(mrb, recur, obj);
}
/* 15.3.1.3.31 */
/*
......
......@@ -337,7 +337,7 @@ read_debug_record(mrb_state *mrb, const uint8_t *start, mrb_irep* irep, size_t *
size_t len;
int ret;
ret =read_debug_record(mrb, bin, irep->reps[i], &len, filenames, filenames_len);
ret = read_debug_record(mrb, bin, irep->reps[i], &len, filenames, filenames_len);
if (ret != MRB_DUMP_OK) return ret;
bin += len;
}
......@@ -570,7 +570,6 @@ MRB_API mrb_value
mrb_load_irep_cxt(mrb_state *mrb, const uint8_t *bin, mrbc_context *c)
{
mrb_irep *irep = mrb_read_irep(mrb, bin);
mrb_value val;
struct RProc *proc;
if (!irep) {
......@@ -580,8 +579,7 @@ mrb_load_irep_cxt(mrb_state *mrb, const uint8_t *bin, mrbc_context *c)
proc = mrb_proc_new(mrb, irep);
mrb_irep_decref(mrb, irep);
if (c && c->no_exec) return mrb_obj_value(proc);
val = mrb_toplevel_run(mrb, proc);
return val;
return mrb_toplevel_run(mrb, proc);
}
MRB_API mrb_value
......
......@@ -310,11 +310,8 @@ convert_type(mrb_state *mrb, mrb_value val, const char *tname, const char *metho
if (!mrb_respond_to(mrb, val, m)) {
if (raise) {
mrb_raisef(mrb, E_TYPE_ERROR, "can't convert %S into %S", inspect_type(mrb, val), mrb_str_new_cstr(mrb, tname));
return mrb_nil_value();
}
else {
return mrb_nil_value();
}
return mrb_nil_value();
}
return mrb_funcall_argv(mrb, val, m, 0, 0);
}
......
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