* eval.c (rb_exec_end_proc): should not clear end_procs and

ephemeral_end_procs before execution. [ruby-dev:22144]

* eval.c (rb_obj_extend): call Module#extended hook after
  extended_object.  [ruby-list:38866]

* object.c (Init_Object): Module#extended defined.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-12-05 05:54:00 +00:00
Родитель 491b450f93
Коммит aabecebd69
3 изменённых файлов: 26 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,13 @@
Fri Dec 5 13:36:59 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_exec_end_proc): should not clear end_procs and
ephemeral_end_procs before execution. [ruby-dev:22144]
* eval.c (rb_obj_extend): call Module#extended hook after
extended_object. [ruby-list:38866]
* object.c (Init_Object): Module#extended defined.
Fri Dec 5 13:17:30 2003 Tanaka Akira <akr@m17n.org>
* test/ruby/test_pipe.rb: use IO.pipe instead of IO.popen.

23
eval.c
Просмотреть файл

@ -6381,12 +6381,12 @@ rb_mod_include(argc, argv, module)
VALUE *argv;
VALUE module;
{
while (argc--) {
VALUE m = argv[argc];
int i;
Check_Type(m, T_MODULE);
rb_funcall(m, rb_intern("append_features"), 1, module);
rb_funcall(m, rb_intern("included"), 1, module);
for (i=0; i<argc; i++) Check_Type(argv[i], T_MODULE);
while (argc--) {
rb_funcall(argv[argc], rb_intern("append_features"), 1, module);
rb_funcall(argv[argc], rb_intern("included"), 1, module);
}
return module;
}
@ -6431,6 +6431,7 @@ rb_obj_extend(argc, argv, obj)
for (i=0; i<argc; i++) Check_Type(argv[i], T_MODULE);
while (argc--) {
rb_funcall(argv[argc], rb_intern("extend_object"), 1, obj);
rb_funcall(argv[argc], rb_intern("extended"), 1, obj);
}
return obj;
}
@ -6523,7 +6524,7 @@ struct end_proc_data {
struct end_proc_data *next;
};
static struct end_proc_data *end_procs, *ephemeral_end_procs;
static struct end_proc_data *end_procs, *ephemeral_end_procs, *tmp_end_procs;
void
rb_set_end_proc(func, data)
@ -6557,6 +6558,11 @@ rb_mark_end_proc()
rb_gc_mark(link->data);
link = link->next;
}
link = tmp_end_procs;
while (link) {
rb_gc_mark(link->data);
link = link->next;
}
}
static void call_end_proc _((VALUE data));
@ -6607,7 +6613,7 @@ rb_exec_end_proc()
volatile int safe = ruby_safe_level;
while (ephemeral_end_procs) {
link = ephemeral_end_procs;
tmp_end_procs = link = ephemeral_end_procs;
ephemeral_end_procs = 0;
while (link) {
PUSH_TAG(PROT_NONE);
@ -6625,7 +6631,7 @@ rb_exec_end_proc()
}
}
while (end_procs) {
link = end_procs;
tmp_end_procs = link = end_procs;
end_procs = 0;
while (link) {
PUSH_TAG(PROT_NONE);
@ -6642,6 +6648,7 @@ rb_exec_end_proc()
free(tmp);
}
}
tmp_end_procs = 0;
ruby_safe_level = safe;
}

Просмотреть файл

@ -1382,6 +1382,7 @@ Init_Object()
rb_define_private_method(rb_cObject, "initialize", rb_obj_dummy, 0);
rb_define_private_method(rb_cClass, "inherited", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "included", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "extended", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "method_added", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "method_removed", rb_obj_dummy, 1);
rb_define_private_method(rb_cModule, "method_undefined", rb_obj_dummy, 1);