Fix ruby normalising to_vool
So that vool layer never has complex conditions or returns Start with while, next if, return and assign
This commit is contained in:
@ -2,6 +2,10 @@ module Vool
|
||||
|
||||
class IvarAssignment < Assignment
|
||||
|
||||
def to_s(depth = 0)
|
||||
"@#{super(depth)}"
|
||||
end
|
||||
|
||||
def to_mom( compiler )
|
||||
to = Mom::SlotDefinition.new(:message ,[ :receiver , @name])
|
||||
from = @value.slot_definition(compiler)
|
||||
|
@ -36,7 +36,6 @@ module Vool
|
||||
# - Setting up the next message, with receiver, arguments, and (importantly) return address
|
||||
# - a CachedCall , or a SimpleCall, depending on wether the receiver type can be determined
|
||||
def to_mom( compiler )
|
||||
puts "Compiling #{self.to_s}"
|
||||
@receiver = SelfExpression.new(compiler.receiver_type) if @receiver.is_a?(SelfExpression)
|
||||
if(@receiver.ct_type)
|
||||
method = @receiver.ct_type.resolve_method(self.name)
|
||||
|
@ -33,6 +33,9 @@ module Vool
|
||||
def shift
|
||||
@statements.shift
|
||||
end
|
||||
def pop
|
||||
@statements.pop
|
||||
end
|
||||
|
||||
# to_mom all the statements. Append subsequent ones to the first, and return the
|
||||
# first.
|
||||
|
@ -14,6 +14,7 @@ module Vool
|
||||
cond_label = Mom::Label.new(self, "cond_label_#{object_id.to_s(16)}")
|
||||
codes = cond_label
|
||||
codes << @hoisted.to_mom(compiler) if @hoisted
|
||||
codes << @condition.to_mom(compiler) if @condition.is_a?(SendStatement)
|
||||
codes << Mom::TruthCheck.new(condition.slot_definition(compiler) , merge_label)
|
||||
codes << @body.to_mom(compiler)
|
||||
codes << Mom::Jump.new(cond_label)
|
||||
|
Reference in New Issue
Block a user