change method and frame around in calling, easier to understand static first

This commit is contained in:
Torsten Ruger
2014-07-24 14:56:27 +03:00
parent e408b0e4b9
commit e427bcef43
9 changed files with 29 additions and 29 deletions

View File

@@ -1,17 +1,17 @@
module Ast
class WhileExpression < Expression
# attr_reader :condition, :body
def compile frame , method
def compile method , frame
start = Virtual::Label.new("while_start")
method.add start
is = condition.compile(frame , method)
is = condition.compile(method,frame)
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(frame,method )
last = part.compile(method,frame )
raise part.inspect if last.nil?
end
# unconditionally brnach to the start