pass message to compile, not frame

This commit is contained in:
Torsten Ruger
2014-07-25 10:49:34 +03:00
parent 13a05e7b72
commit 8d7b353f33
7 changed files with 31 additions and 31 deletions

View File

@@ -1,17 +1,17 @@
module Ast
class WhileExpression < Expression
# attr_reader :condition, :body
def compile method , frame
def compile method , message
start = Virtual::Label.new("while_start")
method.add start
is = condition.compile(method,frame)
is = condition.compile(method,message)
branch = Virtual::ImplicitBranch.new "while"
merge = Virtual::Label.new(branch.name)
branch.other = merge #false jumps to end of while
method.add branch
last = is
body.each do |part|
last = part.compile(method,frame )
last = part.compile(method,message )
raise part.inspect if last.nil?
end
# unconditionally brnach to the start