From: "Nobuyoshi.Nakada" Date: 2001-02-27T16:56:04+09:00 Subject: [ruby-list:28343] Re: argument to instance_eval block(Re: なかだです。 At Tue, 27 Feb 2001 15:19:21 +0900 "K.Kosako" wrote: > 実装上、特異クラスを作れない(あるいは作らない)クラスの > インスタンスに対して、instance_evalの中で定数を参照すると > 死んでしまいます。(定数は定義していなくても同じ) > 誰も困る人はいないと思って、報告していませんでしたが。 いってくれればいいのに。 Index: eval.c =================================================================== RCS file: /home/cvs/ruby/src/ruby/eval.c,v retrieving revision 1.157 diff -u -2 -p -r1.157 eval.c --- eval.c 2001/02/26 05:29:00 1.157 +++ eval.c 2001/02/27 07:56:05 @@ -1450,5 +1450,5 @@ ev_const_get(cref, id) VALUE result; - while (cbase && cbase->nd_clss != rb_cObject) { + while (cbase && !NIL_P(cbase->nd_clss) && cbase->nd_clss != rb_cObject) { struct RClass *klass = RCLASS(cbase->nd_clss); @@ -1458,5 +1458,5 @@ ev_const_get(cref, id) cbase = cbase->nd_next; } - return rb_const_get(cref->nd_clss, id); + return rb_const_get(NIL_P(cref->nd_clss) ? rb_cObject : cref->nd_clss, id); } -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦