Commit 2f4eed25 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1889 from iij/pr-struct-new-block-def

Set the newly created Struct object to self in its initialization block.
parents 792c1add 40c18fca
......@@ -364,6 +364,7 @@ void mrb_print_error(mrb_state *mrb);
mrb_value mrb_yield(mrb_state *mrb, mrb_value b, mrb_value arg);
mrb_value mrb_yield_argv(mrb_state *mrb, mrb_value b, int argc, mrb_value *argv);
mrb_value mrb_yield_internal(mrb_state *mrb, mrb_value b, int argc, mrb_value *argv, mrb_value self, struct RClass *c);
void mrb_gc_protect(mrb_state *mrb, mrb_value obj);
mrb_value mrb_to_int(mrb_state *mrb, mrb_value val);
......
......@@ -59,9 +59,6 @@ nil_to_i(mrb_state *mrb, mrb_value obj)
* k.instance_exec(5) {|x| @secret+x } #=> 104
*/
mrb_value
mrb_yield_internal(mrb_state *mrb, mrb_value b, int argc, mrb_value *argv, mrb_value self, struct RClass *c);
static mrb_value
mrb_obj_instance_exec(mrb_state *mrb, mrb_value self)
{
......
......@@ -382,7 +382,7 @@ mrb_struct_s_def(mrb_state *mrb, mrb_value klass)
}
st = make_struct(mrb, name, rest, struct_class(mrb));
if (!mrb_nil_p(b)) {
mrb_funcall(mrb, b, "call", 1, st);
mrb_yield_internal(mrb, b, 1, &st, st, mrb_class_ptr(klass));
}
return st;
......
......@@ -943,8 +943,6 @@ mrb_mod_instance_methods(mrb_state *mrb, mrb_value mod)
return mrb_class_instance_method_list(mrb, recur, c, 0);
}
mrb_value mrb_yield_internal(mrb_state *mrb, mrb_value b, int argc, mrb_value *argv, mrb_value self, struct RClass *c);
/* 15.2.2.4.35 */
/*
* call-seq:
......
......@@ -455,8 +455,6 @@ mrb_obj_init_copy(mrb_state *mrb, mrb_value self)
return self;
}
mrb_value mrb_yield_internal(mrb_state *mrb, mrb_value b, int argc, mrb_value *argv, mrb_value self, struct RClass *c);
/* 15.3.1.3.18 */
/*
* call-seq:
......
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