[#21296] test and sample directory — "NAKAMURA, Hiroshi" <nakahiro@...>
なひです。
5 messages
2003/09/01
[#21325] illegal member in %w array — kkosako@...
%w配列で、継続行の先頭が空白のときに
5 messages
2003/09/04
[#21337] Re: illegal member in %w array — kkosako@...
> From: matz@ruby-lang.org [mailto:matz@ruby-lang.org]
12 messages
2003/09/04
[#21339] Re: illegal member in %w array
— matz@... (Yukihiro Matsumoto)
2003/09/04
まつもと ゆきひろです
[#21338] $SAFE=4 での autoload — Hidetoshi NAGAI <nagai@...>
永井@知能.九工大です.
21 messages
2003/09/04
[#21346] Re: $SAFE=4 での autoload
— nobu.nakada@...
2003/09/04
なかだです。
[#21359] Re: $SAFE=4 での autoload
— Hidetoshi NAGAI <nagai@...>
2003/09/05
永井@知能.九工大です.
[#21361] Re: $SAFE=4 での autoload
— matz@... (Yukihiro Matsumoto)
2003/09/06
まつもと ゆきひろです
[#21363] Re: $SAFE=4 でのautoload
— nobu.nakada@...
2003/09/08
なかだです。
[#21364] Re: $SAFE=4 でのautoload
— matz@... (Yukihiro Matsumoto)
2003/09/08
まつもと ゆきひろです
[#21369] ext/openssl on mswin32 — Tietew <tietew-ml-ruby-dev@...>
Tietew です。
4 messages
2003/09/10
[#21384] LocalJumpError -> ThreadError — Masatoshi Seki <m_seki@...>
12 messages
2003/09/16
[#21385] Re: LocalJumpError -> ThreadError
— matz@... (Yukihiro Matsumoto)
2003/09/16
まつもと ゆきひろです
[#21386] Re: LocalJumpError -> ThreadError
— Masatoshi Seki <m_seki@...>
2003/09/16
咳といいます。
[#21388] Re: LocalJumpError -> ThreadError
— matz@... (Yukihiro Matsumoto)
2003/09/17
まつもと ゆきひろです
[#21389] Re: LocalJumpError -> ThreadError
— m_seki@...
2003/09/17
[#21403] Building 1.8.0 on Solaris with Sun CC — Masahiro TANAKA <masa@...>
9 messages
2003/09/22
[#21405] Re: Building 1.8.0 on Solaris with Sun CC
— 桑村慎哉 <kuwa@...>
2003/09/25
桑村です。
[#21414] deferred finalizers — nobu.nakada@...
なかだです。
5 messages
2003/09/26
[#21415] 定数のスコープ — akira yamada <akira@...>
8 messages
2003/09/26
[#21416] warnの戻り値 — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
8 messages
2003/09/26
[#21419] Makefile.inのlex.c — Kazuhiro NISHIYAMA <zn@...>
西山和広です。
15 messages
2003/09/28
[#21422] Re: Makefile.inのlex.c
— matz@... (Yukihiro Matsumoto)
2003/09/28
まつもと ゆきひろです
[#21434] break from block yielded in until — Minero Aoki <aamine@...>
青木です。
13 messages
2003/09/29
[#21439] Re: break from block yielded in until
— Tietew <tietew-ml-ruby-dev@...>
2003/09/30
[#21442] Re: break from block yielded in until
— matz@... (Yukihiro Matsumoto)
2003/09/30
まつもと ゆきひろです
[ruby-dev:21406] defined?(super) from module
From:
nobu.nakada@...
Date:
2003-09-25 12:53:46 UTC
List:
ruby-dev #21406
なかだです。
moduleのメソッド内で、defined?(super)と実際にsuperが呼べるかが
食い違うことがあるようです。
module M1
def foo
"OK"
end
end
module M2
def foo
[defined?(super), super]
end
end
class C
include M1
include M2
end
p C.new.foo # => [nil, "OK"]
* eval.c (is_defined): inheritance line adjustment as like as
rb_call_super().
Index: eval.c
===================================================================
RCS file: /cvs/ruby/src/ruby/eval.c,v
retrieving revision 1.539
diff -u -2 -p -r1.539 eval.c
--- eval.c 24 Sep 2003 23:56:11 -0000 1.539
+++ eval.c 25 Sep 2003 07:59:05 -0000
@@ -1988,5 +1988,17 @@ arg_defined(self, node, buf, type)
return type;
}
-
+
+static VALUE
+last_class(self, klass)
+ VALUE self, klass;
+{
+ VALUE k = CLASS_OF(self);
+
+ while (k && !(BUILTIN_TYPE(k) == T_ICLASS && RBASIC(k)->klass == klass)) {
+ k = RCLASS(k)->super;
+ }
+ return k;
+}
+
static char*
is_defined(self, node, buf)
@@ -2005,6 +2017,10 @@ is_defined(self, node, buf)
if (ruby_frame->orig_func == 0) return 0;
else if (ruby_frame->last_class == 0) return 0;
- else if (rb_method_boundp(RCLASS(ruby_frame->last_class)->super,
- ruby_frame->orig_func, 0)) {
+ val = ruby_frame->last_class;
+ if (BUILTIN_TYPE(val) == T_MODULE) {
+ val = last_class(self, val);
+ if (!val) return 0;
+ }
+ if (rb_method_boundp(RCLASS(val)->super, ruby_frame->orig_func, 0)) {
if (nd_type(node) == NODE_SUPER) {
return arg_defined(self, node->nd_args, buf, "super");
@@ -5237,12 +5253,9 @@ rb_call_super(argc, argv)
klass = ruby_frame->last_class;
if (BUILTIN_TYPE(klass) == T_MODULE) {
- k = CLASS_OF(self);
- while (!(BUILTIN_TYPE(k) == T_ICLASS && RBASIC(k)->klass == klass)) {
- k = RCLASS(k)->super;
- if (!k) {
- rb_raise(rb_eTypeError, "%s is not included in %s",
- rb_class2name(klass),
- rb_class2name(CLASS_OF(self)));
- }
+ k = last_class(self, klass);
+ if (!k) {
+ rb_raise(rb_eTypeError, "%s is not included in %s",
+ rb_class2name(klass),
+ rb_class2name(CLASS_OF(self)));
}
if (RCLASS(k)->super == 0) {
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦