GitHub

Original file line numberDiff line numberDiff line change

@@ -216,10 +216,7 @@ mrb_data_s_def(mrb_state *mrb, mrb_value klass)

216216

mrb_int argc;

217217
218218

mrb_get_args(mrb, "*&", &argv, &argc, &b);

219-

if (argc == 0) { /* special case to avoid crash */

220-

mrb_argnum_error(mrb, argc, 1, -1);

221-

}

222-

else {

219+

if (argc > 0) {

223220

rest = mrb_ary_new_from_values(mrb, argc, argv);

224221

for (mrb_int i=0; i<argc; i++) {

225222

id = mrb_obj_to_sym(mrb, RARRAY_PTR(rest)[i]);

@@ -229,10 +226,8 @@ mrb_data_s_def(mrb_state *mrb, mrb_value klass)

229226

if (!mrb_nil_p(b)) {

230227

mrb_yield_with_class(mrb, b, 1, &data, data, mrb_class_ptr(data));

231228

}

232-

return data;

233229

}

234-

/* not reached */

235-

return mrb_nil_value();

230+

return data;

236231

}

237232
238233

static mrb_value

Read the original on github.com ↗