still recoving from previous block - function change. no more exceptions at least

This commit is contained in:
Torsten Ruger
2014-06-11 00:38:46 +03:00
parent e9519d4f05
commit 7cca50cd3a
9 changed files with 72 additions and 74 deletions

View File

@@ -4,12 +4,13 @@ module Ast
def compile context
into = context.function
while_block = into.new_block "while"
ret = while_block.new_block "return"
ret = into.new_block "return"
into.insert_at while_block
puts "compiling while condition #{condition}"
cond_val = condition.compile(context)
while_block.b ret , condition_code: cond_val.not_operator
while_block.branch = ret
into.b ret , condition_code: cond_val.not_operator
into.insertion_point.branch = ret
last = nil
@@ -17,7 +18,9 @@ module Ast
puts "compiling in while #{part}"
last = part.compile(context)
end
while_block.b while_block
into.b while_block
into.insertion_point.branch = while_block
puts "compile while end"
into.insert_at ret
return last