78ef1368de
not everything statement anymore (as in ruby) basic statement tests working, rest havoc
17 lines
522 B
Ruby
17 lines
522 B
Ruby
module Vool
|
|
module Normalizer
|
|
# given a something, determine if it is a Name
|
|
#
|
|
# Return a Name, and a possible rest that has a hoisted part of the statement
|
|
#
|
|
# 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)
|
|
local = method.create_tmp
|
|
assign = LocalAssignment.new( local , @condition)
|
|
[LocalVariable.new(local) , assign]
|
|
end
|
|
end
|
|
end
|