clean up intruction instantiation and fix tests

This commit is contained in:
Torsten Ruger
2014-05-14 10:47:30 +03:00
parent 46ea1df51e
commit 2230a4f25e
16 changed files with 86 additions and 76 deletions

View File

@ -34,15 +34,11 @@ module Ast
context.locals = locals
context.function = function
into = function.entry
into = function.body
block.each do |b|
compiled = b.compile(context , into)
if compiled.is_a? Vm::Block
into = compiled
he.breaks.loose
else
function.body.add_code compiled
end
function.return_type = compiled
raise "alarm " unless compiled.is_a? Vm::Word
puts compiled.inspect
end
context.locals = parent_locals