rename
This commit is contained in:
@ -13,7 +13,7 @@ module Vool
|
||||
end
|
||||
|
||||
def normalize(method)
|
||||
cond , rest = *normalize_name(@condition)
|
||||
cond , rest = *normalize_name(@condition, method)
|
||||
fals = @if_false ? @if_false.normalize(method) : nil
|
||||
me = IfStatement.new(cond , @if_true.normalize(method), fals)
|
||||
return me unless rest
|
||||
|
@ -6,10 +6,10 @@ 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( method )
|
||||
return [@condition] if @condition.is_a?(Named)
|
||||
def normalize_name( condition , method )
|
||||
return [condition] if condition.is_a?(Named)
|
||||
local = method.create_tmp
|
||||
assign = LocalAssignment.new( local , @condition)
|
||||
assign = LocalAssignment.new( local , condition)
|
||||
[LocalVariable.new(local) , assign]
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user