Commit af26d07f authored by Stefan Marr's avatar Stefan Marr

Fixed incomplete initialization for classes of nil, true, and false

The classes were not put into the globals dictionary and got loaded more than once, which lead to the classes being not equal to each other.
Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent b612e185
......@@ -255,8 +255,13 @@ class Universe(object):
self.blockClass = self.load_class(self.symbol_for("Block"))
# Setup the true and false objects
self.trueObject = self.new_instance(self.load_class(self.symbol_for("True")))
self.falseObject = self.new_instance(self.load_class(self.symbol_for("False")))
trueClassName = self.symbol_for("True")
trueClass = self.load_class(trueClassName)
self.trueObject = self.new_instance(trueClass)
falseClassName = self.symbol_for("False")
falseClass = self.load_class(falseClassName)
self.falseObject = self.new_instance(falseClass)
# Load the system class and create an instance of it
self.systemClass = self.load_class(self.symbol_for("System"))
......@@ -269,6 +274,12 @@ class Universe(object):
self.set_global(self.symbol_for("system"), system_object)
self.set_global(self.symbol_for("System"), self.systemClass)
self.set_global(self.symbol_for("Block"), self.blockClass)
self.set_global(self.symbol_for("Nil"), self.nilClass)
self.set_global( trueClassName, trueClass)
self.set_global(falseClassName, falseClass)
return system_object
def symbol_for(self, string):
......
......@@ -4,6 +4,7 @@ from som.vm.universe import Universe
class SomTest(unittest.TestCase):
@parameterized.expand([
("ClassStructure",),
("Array" ,),
("BigInteger" ,),
("Block" ,),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment