passing compiler to to_mom, not method

To be able to delegate scope (block/method) things later
This commit is contained in:
Torsten Ruger
2018-07-05 14:02:38 +03:00
parent 16d91f24ce
commit 3f80953385
15 changed files with 78 additions and 74 deletions

View File

@ -20,31 +20,31 @@ module Vool
rest
end
def to_mom( method )
if_false ? full_if(method) : simple_if(method)
def to_mom( compiler )
if_false ? full_if(compiler) : simple_if(compiler)
end
def simple_if(method)
def simple_if(compiler)
true_label = Mom::Label.new( "true_label_#{object_id.to_s(16)}")
merge_label = Mom::Label.new( "merge_label_#{object_id.to_s(16)}")
head = Mom::TruthCheck.new(condition.slot_definition(method) , merge_label)
head = Mom::TruthCheck.new(condition.slot_definition(compiler) , merge_label)
head << true_label
head << if_true.to_mom(method)
head << if_true.to_mom(compiler)
head << merge_label
end
def full_if(method)
def full_if(compiler)
true_label = Mom::Label.new( "true_label_#{object_id.to_s(16)}")
false_label = Mom::Label.new( "false_label_#{object_id.to_s(16)}")
merge_label = Mom::Label.new( "merge_label_#{object_id.to_s(16)}")
head = Mom::TruthCheck.new(condition.slot_definition(method) , false_label)
head = Mom::TruthCheck.new(condition.slot_definition(compiler) , false_label)
head << true_label
head << if_true.to_mom(method)
head << if_true.to_mom(compiler)
head << Mom::Jump.new(merge_label)
head << false_label
head << if_false.to_mom(method)
head << if_false.to_mom(compiler)
head << merge_label
end