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,15 +1,15 @@
module Ast
class IfExpression < Expression
# attr_reader :cond, :if_true, :if_false
def compile frame , method
is = cond.compile(frame , method)
def compile method , frame
is = cond.compile(method,frame)
# is.is_false(frame,method)
# TODO should/will use different branches for different conditions.
branch = Virtual::ImplicitBranch.new "if_merge"
method.add branch
last = is
if_true.each do |part|
last = part.compile(frame,method )
last = part.compile(method,frame )
raise part.inspect if last.nil?
end
merge = Virtual::Label.new(branch.name)
@ -17,7 +17,7 @@ module Ast
branch.swap
method.current = branch
if_false.each do |part|
last = part.compile(frame,method )
last = part.compile(method,frame )
raise part.inspect if last.nil?
end
method.add merge