still recoving from previous block - function change. no more exceptions at least
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user