summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--MANIFEST1
-rw-r--r--class.c4
-rw-r--r--eval.c17
-rw-r--r--intern.h2
-rw-r--r--lib/irb/completion.rb2
6 files changed, 32 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 392cd48cad..960964b133 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,20 @@ Sun Dec 22 00:36:43 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* lib/mkmf.rb (create_makefile): accept pure ruby libraries.
+Sat Dec 21 23:59:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (ins_methods_i): should not show ID_ALLOCATOR.
+
+ * class.c (ins_methods_prot_i): ditto.
+
+ * class.c (ins_methods_priv_i): ditto.
+
+ * class.c (ins_methods_pub_i): ditto.
+
+ * eval.c (call_trace_func): ditto.
+
+ * eval.c (rb_undefined): ditto.
+
Sat Dec 21 07:27:24 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* misc/ruby-mode.el (ruby-parse-partial): keywords must not be
diff --git a/MANIFEST b/MANIFEST
index 226a4d8935..bed404c9c9 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -197,6 +197,7 @@ lib/ping.rb
lib/pp.rb
lib/prettyprint.rb
lib/profile.rb
+lib/profiler.rb
lib/pstore.rb
lib/racc/parser.rb
lib/rational.rb
diff --git a/class.c b/class.c
index 6aed94a992..a18cdbcc93 100644
--- a/class.c
+++ b/class.c
@@ -459,6 +459,7 @@ ins_methods_i(key, body, ary)
NODE *body;
VALUE ary;
{
+ if (key == ID_ALLOCATOR) return ST_CONTINUE;
if (!body->nd_body) {
rb_ary_push(ary, Qnil);
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
@@ -483,6 +484,7 @@ ins_methods_prot_i(key, body, ary)
NODE *body;
VALUE ary;
{
+ if (key == ID_ALLOCATOR) return ST_CONTINUE;
if (!body->nd_body) {
rb_ary_push(ary, Qnil);
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
@@ -507,6 +509,7 @@ ins_methods_priv_i(key, body, ary)
NODE *body;
VALUE ary;
{
+ if (key == ID_ALLOCATOR) return ST_CONTINUE;
if (!body->nd_body) {
rb_ary_push(ary, Qnil);
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
@@ -531,6 +534,7 @@ ins_methods_pub_i(key, body, ary)
NODE *body;
VALUE ary;
{
+ if (key == ID_ALLOCATOR) return ST_CONTINUE;
if (!body->nd_body) {
rb_ary_push(ary, Qnil);
rb_ary_push(ary, rb_str_new2(rb_id2name(key)));
diff --git a/eval.c b/eval.c
index e9f07a61ba..2036c3efda 100644
--- a/eval.c
+++ b/eval.c
@@ -230,7 +230,7 @@ rb_clear_cache_by_class(klass)
}
}
-static ID init, alloc, eqq, each, aref, aset, match, missing;
+static ID init, eqq, each, aref, aset, match, missing;
static ID added, singleton_added;
static ID __id__, __send__;
@@ -247,10 +247,13 @@ 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 && !FL_TEST(klass, FL_SINGLETON) && node && nd_type(node) != NODE_ZSUPER) {
+ if (!FL_TEST(klass, FL_SINGLETON) &&
+ node && nd_type(node) != NODE_ZSUPER &&
+ mid == rb_intern("initialize")) {
noex = NOEX_PRIVATE | (noex & NOEX_NOSUPER);
}
- else if (mid == alloc && FL_TEST(klass, FL_SINGLETON) && node && nd_type(node) == NODE_CFUNC) {
+ else if (FL_TEST(klass, FL_SINGLETON) && node && nd_type(node) == NODE_CFUNC &&
+ mid == rb_intern("allocate")) {
rb_warn("defining %s.allocate is deprecated; use rb_define_alloc_func()",
rb_class2name(rb_iv_get(klass, "__attached__")));
mid = ID_ALLOCATOR;
@@ -2105,6 +2108,7 @@ call_trace_func(event, node, self, id, klass)
if (!trace_func) return;
if (tracing) return;
if (ruby_in_compile) return;
+ if (id == ID_ALLOCATOR) return;
node_save[0] = ruby_last_node;
if (!(node_save[1] = ruby_current_node)) {
@@ -4408,7 +4412,7 @@ rb_f_missing(argc, argv, obj)
if (last_call_status & CSTAT_PRIV) {
format = "private method `%s' called for %s%s%s";
}
- if (last_call_status & CSTAT_PROT) {
+ else if (last_call_status & CSTAT_PROT) {
format = "protected method `%s' called for %s%s%s";
}
else if (last_call_status & CSTAT_VCALL) {
@@ -4460,6 +4464,9 @@ rb_undefined(obj, id, argc, argv, call_status)
rb_f_missing(argc, argv, obj);
POP_FRAME();
}
+ else if (id == ID_ALLOCATOR) {
+ rb_fatal("allocator undefined for %s", rb_class2name(obj));
+ }
nargv = ALLOCA_N(VALUE, argc+1);
nargv[0] = ID2SYM(id);
@@ -4608,7 +4615,6 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
if (trace_func) {
int state;
- if (id == ID_ALLOCATOR) id = alloc;
call_trace_func("c-call", ruby_current_node, recv, id, klass);
PUSH_TAG(PROT_FUNC);
if ((state = EXEC_TAG()) == 0) {
@@ -6160,7 +6166,6 @@ void
Init_eval()
{
init = rb_intern("initialize");
- alloc = rb_intern("allocate");
eqq = rb_intern("===");
each = rb_intern("each");
diff --git a/intern.h b/intern.h
index 46ceb7d270..8aacb73fba 100644
--- a/intern.h
+++ b/intern.h
@@ -17,7 +17,7 @@
* the kernel.
*/
-#define ID_ALLOCATOR 1
+#define ID_ALLOCATOR 0
/* array.c */
void rb_mem_clear _((register VALUE*, register long));
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 30d60c2449..448650e8ed 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -122,7 +122,7 @@ module IRB
gv = eval "global_variables", bind
lv = eval "local_variables", bind
- cv = eval "type.constants", bind
+ cv = eval "self.type.constants", bind
if (gv | lv | cv).include?(receiver)
# foo.func and foo is local var.