Skip to content

Commit

Permalink
* class.c (ins_methods_i): should not show ID_ALLOCATOR.
Browse files Browse the repository at this point in the history
* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Dec 24, 2002
1 parent 2b33401 commit e274c3a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand All @@ -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)));
Expand All @@ -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)));
Expand All @@ -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)));
Expand Down
17 changes: 11 additions & 6 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__;

Expand All @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -6160,7 +6166,6 @@ void
Init_eval()
{
init = rb_intern("initialize");
alloc = rb_intern("allocate");
eqq = rb_intern("===");
each = rb_intern("each");

Expand Down
2 changes: 1 addition & 1 deletion intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* the kernel.
*/

#define ID_ALLOCATOR 1
#define ID_ALLOCATOR 0

/* array.c */
void rb_mem_clear _((register VALUE*, register long));
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/completion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module InputCompletor

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.
Expand Down

0 comments on commit e274c3a

Please sign in to comment.