gets the if coded, but test fail die to instruction being a graph now
This commit is contained in:
@ -3,12 +3,27 @@ module Ast
|
||||
# attr_reader :cond, :if_true, :if_false
|
||||
def compile frame , method
|
||||
is = cond.compile(frame , method)
|
||||
# is.is_false(frame,method)
|
||||
# is.is_false(frame,method)
|
||||
# TODO should/will use different branches for different conditions.
|
||||
branch = Virtual::ImplicitBranch.new
|
||||
method.add branch
|
||||
last = is
|
||||
if_true.each do |part|
|
||||
last = part.compile(frame,method )
|
||||
raise part.inspect if last.nil?
|
||||
end
|
||||
label = Virtual::Label.new
|
||||
method.add label
|
||||
branch.swap
|
||||
method.current = branch
|
||||
if_false.each do |part|
|
||||
last = part.compile(frame,method )
|
||||
raise part.inspect if last.nil?
|
||||
end
|
||||
method.add label
|
||||
branch.swap
|
||||
method.current = label
|
||||
#TODO should return the union of the true and false types
|
||||
last
|
||||
end
|
||||
def old
|
||||
|
Reference in New Issue
Block a user