fix if to_vool
and add (simple) hoisting tests
This commit is contained in:
@ -14,8 +14,8 @@ module Ruby
|
||||
|
||||
def to_vool
|
||||
cond , rest = *normalize_name(@condition)
|
||||
fals = @if_false ? @if_false.normalize : nil
|
||||
me = IfStatement.new(cond , @if_true.normalize, fals)
|
||||
fals = @if_false ? @if_false.to_vool : nil
|
||||
me = Vool::IfStatement.new(cond , @if_true.to_vool, fals)
|
||||
return me unless rest
|
||||
rest << me
|
||||
rest
|
||||
|
@ -12,7 +12,7 @@ module Ruby
|
||||
if( condition.is_a?(ScopeStatement) and condition.single?)
|
||||
condition = condition.first
|
||||
end
|
||||
return [condition] if condition.is_a?(Named) or condition.is_a?(Constant)
|
||||
return [condition.to_vool] if condition.is_a?(Named) or condition.is_a?(Constant)
|
||||
condition = condition.to_vool
|
||||
local = "tmp_#{object_id}".to_sym
|
||||
assign = Vool::Statements.new [Vool::LocalAssignment.new( local , condition)]
|
||||
|
Reference in New Issue
Block a user