summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-10 13:30:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-10 13:30:17 +0000
commit1b4be57f7e00a7f53eb51e530bceb5154b19e74d (patch)
tree879179635851f784707cc17e51530eaaedc9526d /eval.c
parenta5ef2da1a11af82a44a0ca81f94953a8aa793802 (diff)
* 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
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/eval.c b/eval.c
index f5fbd5c91b..9f8f12aec5 100644
--- a/eval.c
+++ b/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);