that fixes the while. To work. Actually work. Fibonacci and all :-)

This commit is contained in:
Torsten Ruger
2014-05-23 20:27:14 +03:00
parent 7b6d6b9024
commit 2c90006697
2 changed files with 17 additions and 18 deletions

View File

@ -14,8 +14,8 @@ module Ast
[:condition, :body]
end
def compile context , into
while_block = into.new_block "#{into.name}_while_#{hash}"
ret = while_block.new_block "#{into.name}_return_#{hash}"
while_block = into.new_block "#{into.name}_while"
ret = while_block.new_block "#{into.name}_return"
cond_val = condition.compile(context , while_block)
puts "compiled while condition #{cond_val.inspect}"
while_block.b ret , condition_code: cond_val.not_operator
@ -26,7 +26,7 @@ module Ast
end
while_block.b while_block
puts "compile while end"
into.insert_at_end
into.insert_at ret
return last
end
end