summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-07 19:18:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-07 19:18:16 +0000
commit54fdacb12545f40e83b013e7c8207fb5416b1403 (patch)
treea78adc8cdeb42f4a59788e2e5dda13627a130446 /class.c
parent8e3721dfa828464981b5e9f77eff79b815c288d5 (diff)
* class.c (rb_define_method): do not set NOEX_CFUNC if klass is
really a module, whose methods must be safe for reciever's type. * eval.c (rb_eval): nosuper should not be inherited unless the overwritten method is an undef placeholder. * parse.y (primary): allow 'when'-less case statement; persuaded by Sean Chittenden. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/class.c b/class.c
index edd17e1..e680dc7 100644
--- a/class.c
+++ b/class.c
@@ -684,10 +684,13 @@ rb_define_method(klass, name, func, argc)
int argc;
{
ID id = rb_intern(name);
+ int ex = NOEX_PUBLIC;
- rb_add_method(klass, id, NEW_CFUNC(func, argc),
- ((name[0] == 'i' && id == rb_intern("initialize"))?
- NOEX_PRIVATE:NOEX_PUBLIC)|NOEX_CFUNC);
+
+ if (BUILTIN_TYPE(klass) == T_CLASS) {
+ ex |= NOEX_CFUNC;
+ }
+ rb_add_method(klass, id, NEW_CFUNC(func, argc), ex);
}
void