зеркало из https://github.com/github/ruby.git
* eval.c (rb_add_method): should clear cache by id always.
* eval.c (rb_disable_super): no longer need to clear cache before rb_add_method(). * eval.c (rb_export_method): ditto. * eval.c (rb_attr): ditto. * eval.c (rb_undef): ditto. * eval.c (rb_eval): ditto. * eval.c (rb_mod_modfunc): ditto. * eval.c (rb_mod_define_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
a5ef2da1a1
Коммит
1b4be57f7e
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
Thu Jan 10 19:15:15 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||
|
||||
* eval.c (rb_add_method): should clear cache by id always.
|
||||
|
||||
* eval.c (rb_disable_super): no longer need to clear cache before
|
||||
rb_add_method().
|
||||
|
||||
* eval.c (rb_export_method): ditto.
|
||||
|
||||
* eval.c (rb_attr): ditto.
|
||||
|
||||
* eval.c (rb_undef): ditto.
|
||||
|
||||
* eval.c (rb_eval): ditto.
|
||||
|
||||
* eval.c (rb_mod_modfunc): ditto.
|
||||
|
||||
* eval.c (rb_mod_define_method): ditto.
|
||||
|
||||
Thu Jan 10 11:42:47 2002 Usaku Nakamura <usa@ruby-lang.org>
|
||||
|
||||
* win32/resource.rb: Modify copyright in resource script.
|
||||
|
|
13
eval.c
13
eval.c
|
@ -228,9 +228,9 @@ rb_add_method(klass, mid, node, noex)
|
|||
rb_raise(rb_eSecurityError, "Insecure: can't define method");
|
||||
}
|
||||
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
|
||||
rb_clear_cache_by_id(mid);
|
||||
body = NEW_METHOD(node, noex);
|
||||
if (st_insert(RCLASS(klass)->m_tbl, mid, body))
|
||||
rb_clear_cache_by_id(mid);
|
||||
st_insert(RCLASS(klass)->m_tbl, mid, body);
|
||||
}
|
||||
|
||||
static NODE*
|
||||
|
@ -358,7 +358,6 @@ rb_disable_super(klass, name)
|
|||
body->nd_noex |= NOEX_UNDEF;
|
||||
}
|
||||
else {
|
||||
rb_clear_cache_by_id(mid);
|
||||
rb_add_method(klass, mid, 0, NOEX_UNDEF);
|
||||
}
|
||||
}
|
||||
|
@ -408,7 +407,6 @@ rb_export_method(klass, name, noex)
|
|||
body->nd_noex = noex;
|
||||
}
|
||||
else {
|
||||
rb_clear_cache_by_id(name);
|
||||
rb_add_method(klass, name, NEW_ZSUPER(), noex);
|
||||
}
|
||||
}
|
||||
|
@ -478,14 +476,12 @@ rb_attr(klass, id, read, write, ex)
|
|||
sprintf(buf, "@%s", name);
|
||||
attriv = rb_intern(buf);
|
||||
if (read) {
|
||||
rb_clear_cache_by_id(id);
|
||||
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
|
||||
rb_funcall(klass, added, 1, ID2SYM(id));
|
||||
}
|
||||
if (write) {
|
||||
sprintf(buf, "%s=", name);
|
||||
id = rb_intern(buf);
|
||||
rb_clear_cache_by_id(id);
|
||||
rb_add_method(klass, id, NEW_ATTRSET(attriv), noex);
|
||||
rb_funcall(klass, added, 1, ID2SYM(id));
|
||||
}
|
||||
|
@ -1584,7 +1580,6 @@ rb_undef(klass, id)
|
|||
rb_name_error(id, "undefined method `%s' for%s `%s'",
|
||||
rb_id2name(id),s0,rb_class2name(c));
|
||||
}
|
||||
rb_clear_cache_by_id(id);
|
||||
rb_add_method(klass, id, 0, NOEX_PUBLIC);
|
||||
if (FL_TEST(klass, FL_SINGLETON)) {
|
||||
rb_funcall(rb_iv_get(klass, "__attached__"),
|
||||
|
@ -3105,7 +3100,6 @@ rb_eval(self, n)
|
|||
}
|
||||
|
||||
defn = copy_node_scope(node->nd_defn, ruby_cref);
|
||||
rb_clear_cache_by_id(node->nd_mid);
|
||||
rb_add_method(ruby_class, node->nd_mid, defn, noex);
|
||||
if (scope_vmode == SCOPE_MODFUNC) {
|
||||
rb_add_method(rb_singleton_class(ruby_class),
|
||||
|
@ -3151,7 +3145,6 @@ rb_eval(self, n)
|
|||
}
|
||||
defn = copy_node_scope(node->nd_defn, ruby_cref);
|
||||
defn->nd_rval = (VALUE)ruby_cref;
|
||||
rb_clear_cache_by_id(node->nd_mid);
|
||||
rb_add_method(klass, node->nd_mid, defn,
|
||||
NOEX_PUBLIC|(body?body->nd_noex&NOEX_UNDEF:0));
|
||||
rb_funcall(recv, singleton_added, 1, ID2SYM(node->nd_mid));
|
||||
|
@ -5714,7 +5707,6 @@ rb_mod_modfunc(argc, argv, module)
|
|||
}
|
||||
m = RCLASS(m)->super;
|
||||
}
|
||||
rb_clear_cache_by_id(id);
|
||||
rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);
|
||||
rb_funcall(module, singleton_added, 1, ID2SYM(id));
|
||||
}
|
||||
|
@ -6981,7 +6973,6 @@ rb_mod_define_method(argc, argv, mod)
|
|||
else {
|
||||
noex = NOEX_PUBLIC;
|
||||
}
|
||||
rb_clear_cache_by_id(id);
|
||||
rb_add_method(mod, id, node, noex);
|
||||
if (scope_vmode == SCOPE_MODFUNC) {
|
||||
rb_add_method(rb_singleton_class(mod), id, node, NOEX_PUBLIC);
|
||||
|
|
Загрузка…
Ссылка в новой задаче