Given getSingletonClass + makeMetaClass on RubyObject and
ClassVarNodeVisitor in EvaluateVisitor, we've got a problem with the
objects attaced to singleton classes. getSingletonClass gets called on
normal objects, right? So then if the singleton class has a class
variable accessed somewhere later, it will blow up since we expect the
attached object for a singleton class to be another RubyModule in
ClassVarNodeVisitor. Seems there needs to be another case for when the
attached object is just a plain old object, yeah? Or am I wrong on the
cause of the issue below?
The following bit of code blows all to hell as a result. I found this
while investigating the cvar failures in C ruby's test_eval.
class A
Const = :A
@ivar = :Ac
@@cvar = :A
def initialize
@ivar = :Ai
end
end
class B
Const = :B
@ivar = :Bc
@@cvar = :B
def initialize
@ivar = :Bi
end
def test_i_i_b() A.new.instance_eval { p [Const, @ivar, @@cvar] } end
def test_i_i_s() A.new.instance_eval " p [Const, @ivar, @@cvar] " end
def test_c_i_b() A.instance_eval { p [Const, @ivar, @@cvar] } end
def test_c_i_s() A.instance_eval " p [Const, @ivar, @@cvar] " end
def test_c_c_b() A.class_eval { p [Const, @ivar, @@cvar] } end
def test_c_c_s() A.class_eval " p [Const, @ivar, @@cvar] " end
end
B.new.test_i_i_b
B.new.test_i_i_s
B.new.test_c_i_b
B.new.test_c_i_s
B.new.test_c_c_b
B.new.test_c_c_s
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Jruby-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jruby-devel