Slotted constructor cleanup

This commit is contained in:
2020-02-17 14:45:54 +07:00
parent c1679bd6ff
commit 2d11078a37
13 changed files with 26 additions and 22 deletions

View File

@ -10,7 +10,7 @@ module Sol
@value = value
end
def to_slotted(_)
return SlotMachine::Slotted.for(SlotMachine::IntegerConstant.new(@value) , [])
return SlotMachine::Slotted.for(SlotMachine::IntegerConstant.new(@value) )
end
def ct_type
Parfait.object_space.get_type_by_class_name(:Integer)
@ -38,7 +38,7 @@ module Sol
Parfait.object_space.get_type_by_class_name(:True)
end
def to_slotted(_)
return SlotMachine::Slotted.for(Parfait.object_space.true_object , [])
return SlotMachine::Slotted.for(Parfait.object_space.true_object )
end
def to_s(depth = 0)
"true"
@ -50,7 +50,7 @@ module Sol
Parfait.object_space.get_type_by_class_name(:False)
end
def to_slotted(_)
return SlotMachine::Slotted.for(Parfait.object_space.false_object , [])
return SlotMachine::Slotted.for(Parfait.object_space.false_object )
end
def to_s(depth = 0)
"false"
@ -62,7 +62,7 @@ module Sol
Parfait.object_space.get_type_by_class_name(:Nil)
end
def to_slotted(_)
return SlotMachine::Slotted.for(Parfait.object_space.nil_object , [])
return SlotMachine::Slotted.for(Parfait.object_space.nil_object )
end
def to_s(depth = 0)
"nil"
@ -92,7 +92,7 @@ module Sol
@value = value
end
def to_slotted(_)
return SlotMachine::Slotted.for(SlotMachine::StringConstant.new(@value),[])
return SlotMachine::Slotted.for(SlotMachine::StringConstant.new(@value))
end
def ct_type
Parfait.object_space.get_type_by_class_name(:Word)

View File

@ -15,7 +15,7 @@ module Sol
# fact never called)
def to_slotted(compiler)
compile(compiler) unless @parfait_block
return SlotMachine::Slotted.for(SlotMachine::LambdaConstant.new(parfait_block(compiler)) , [])
return SlotMachine::Slotted.for(SlotMachine::LambdaConstant.new(parfait_block(compiler)) )
end
# create a block, a compiler for it, compile the block and add the compiler(code)

View File

@ -52,7 +52,7 @@ module Sol
get_named_class.single_class.instance_type
end
def to_slotted(_)
return SlotMachine::Slotted.for( get_named_class, [])
return SlotMachine::Slotted.for( get_named_class)
end
def get_named_class
Parfait.object_space.get_class_by_name(self.name)

View File

@ -34,7 +34,7 @@ module Sol
# we brace ourselves with the check, and exit (later raise) if . . .
def method_check(compiler)
ok_label = SlotMachine::Label.new(self,"method_ok_#{self.object_id}")
compile_method = SlotMachine::Slotted.for( compiler.get_method , [])
compile_method = SlotMachine::Slotted.for( compiler.get_method )
runtime_method = SlotMachine::Slotted.for( :message , [ :method] )
check = SlotMachine::NotSameCheck.new(compile_method , runtime_method, ok_label)
# TODO? Maybe create slot instructions for this