e$B$J$+$@$G$9!#e(B
http://pc11.2ch.net/test/read.cgi/tech/1178167650/498 e$B$G!"0J2<e(B
e$B$N%3!<%I$,e(BSEGVe$B$9$k$H$$$&OC$,=P$F$^$9!#e(B
class C0
def a(*args) p “C0#a”, args end
end
class C1 < C0
def a() @h = Hash.new { super } end
def b(k) @h[k] end
end
class C2 < C0
h = nil
define_method(:a) { h = Hash.new { super } }
define_method(:b) { |k| h[k] }
end
c2 = C2.new
c2.a
c2.b 10
c1 = C1.new
c1.a
c1.b 10
Index: eval.c
— eval.c (revision 12402)
+++ eval.c (working copy)
@@ -3505,4 +3505,8 @@ rb_eval(self, n)
argv = RARRAY(RBASIC(ruby_scope)->klass)->ptr;
}
- else if (!ruby_scope->local_vars) {
-
argc = 0;
-
argv = 0;
- }
else {
argv = ruby_scope->local_vars + 2;