simple sends and all whiles working
This commit is contained in:
@ -7,7 +7,11 @@ module Vool
|
||||
# eg if( @var % 5) is not normalized
|
||||
# but if(tmp_123) is with tmp_123 = @var % 5 hoited above the if
|
||||
def normalize_name( condition )
|
||||
if( condition.is_a?(ScopeStatement) and condition.single?)
|
||||
condition = condition.first
|
||||
end
|
||||
return [condition] if condition.is_a?(Named)
|
||||
condition = condition.normalize
|
||||
local = "tmp_#{object_id}"
|
||||
assign = Statements.new [LocalAssignment.new( local , condition)]
|
||||
[LocalVariable.new(local) , assign]
|
||||
|
@ -11,7 +11,7 @@ module Vool
|
||||
end
|
||||
|
||||
def normalize
|
||||
cond , rest = *normalize_name(@condition.normalize)
|
||||
cond , rest = *normalize_name(@condition)
|
||||
me = WhileStatement.new(cond , @body.normalize)
|
||||
return me unless rest
|
||||
rest << me
|
||||
|
Reference in New Issue
Block a user