summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-14 06:18:59 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-14 06:18:59 +0000
commita1c02ee495d945f943fedc3f11fcb323289dc756 (patch)
tree258fdf9c591ffa5bab8d8be49302198241eb4fa7 /eval.c
parente60d5563210cccef2e9da17970ab3ea1906a8185 (diff)
* math.c (math_acos): check errno after operation. ditto for
asin, acosh, atanh, log, log10 and sqrt. * eval.c (rb_add_method): initialize should always be private. * parse.y (expr): add rescue modifier rule. * parse.y (command_call): return, break and next with argument is now part of this rule. * parse.y (yylex): "a" in "a /5" should be considered as a local variable. [experimental] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index 615df9c36a..3e9548d757 100644
--- a/eval.c
+++ b/eval.c
@@ -230,6 +230,10 @@ rb_clear_cache_by_class(klass)
}
}
+static ID init, alloc, eqq, each, aref, aset, match, missing;
+static ID added, singleton_added;
+static ID __id__, __send__;
+
void
rb_add_method(klass, mid, node, noex)
VALUE klass;
@@ -243,6 +247,9 @@ rb_add_method(klass, mid, node, noex)
if (ruby_safe_level >= 4 && (klass == rb_cObject || !OBJ_TAINTED(klass))) {
rb_raise(rb_eSecurityError, "Insecure: can't define method");
}
+ if (mid == init) {
+ noex = NOEX_PRIVATE | (noex & NOEX_NOSUPER);
+ }
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
rb_clear_cache_by_id(mid);
body = NEW_METHOD(node, noex);
@@ -313,10 +320,6 @@ rb_get_method_body(klassp, idp, noexp)
return body;
}
-static ID init, alloc, eqq, each, aref, aset, match, missing;
-static ID added, singleton_added;
-static ID __id__, __send__;
-
static void
remove_method(klass, mid)
VALUE klass;