fix while.to_vool

sanitize normalizer on the way
- return ruby, let caller to_vool
- return single statement, not single? statements
This commit is contained in:
Torsten Ruger
2018-07-20 17:51:17 +03:00
parent 9b8bd57db4
commit 6a58a71c0a
5 changed files with 47 additions and 10 deletions

View File

@ -12,11 +12,10 @@ module Ruby
if( condition.is_a?(ScopeStatement) and condition.single?)
condition = condition.first
end
return [condition.to_vool] if condition.is_a?(Named) or condition.is_a?(Constant)
condition = condition.to_vool
return [condition] if condition.is_a?(Named) or condition.is_a?(Constant)
local = "tmp_#{object_id}".to_sym
assign = Vool::Statements.new [Vool::LocalAssignment.new( local , condition)]
[Vool::LocalVariable.new(local) , assign]
assign = LocalAssignment.new( local , condition)
[LocalVariable.new(local) , assign]
end
end
end