Rename Vool to Sol

Simple is really the descriptive name for the layer
Sure, it is "virtual" but that is not as important as the fact that it is simple (or simplified)
Also objct (based really) is better, since orientated implies it is a little like that, but only orientated, not really it. Sol only has objects, nothing else
Just cause i was renaming anyway
This commit is contained in:
2019-10-04 00:36:49 +03:00
parent aa9fc8bc81
commit d1f8733623
135 changed files with 636 additions and 636 deletions

View File

@ -0,0 +1,38 @@
module Sol
class WhileStatement < Statement
attr_reader :condition , :body , :hoisted
def initialize( condition , body , hoisted = nil)
@hoisted = hoisted
@condition = condition
@body = body
end
def to_slot( compiler )
merge_label = SlotMachine::Label.new(self, "merge_label_#{object_id.to_s(16)}")
cond_label = SlotMachine::Label.new(self, "cond_label_#{object_id.to_s(16)}")
codes = cond_label
codes << @hoisted.to_slot(compiler) if @hoisted
codes << @condition.to_slot(compiler) if @condition.is_a?(SendStatement)
codes << SlotMachine::TruthCheck.new(condition.to_slot_definition(compiler) , merge_label)
codes << @body.to_slot(compiler)
codes << SlotMachine::Jump.new(cond_label)
codes << merge_label
end
def each(&block)
block.call(self)
@condition.each(&block)
@hoisted.each(&block) if @hoisted
@body.each(&block)
end
def to_s(depth = 0)
lines =[ "while (#{@condition})" , @body.to_s(1) , "end"]
lines.unshift( @hoisted.to_s) if @hoisted
at_depth(depth , *lines )
end
end
end