rename
This commit is contained in:
parent
f09a70a65b
commit
6e6dd257e4
@ -13,7 +13,7 @@ module Ast
|
||||
is = cond.compile(method,message)
|
||||
# TODO should/will use different branches for different conditions.
|
||||
# just a scetch : cond_val = cond_val.is_true?(method) unless cond_val.is_a? Virtual::BranchCondition
|
||||
method.add_code Virtual::ImplicitBranch.new( true_block )
|
||||
method.add_code Virtual::IsTrueBranch.new( true_block )
|
||||
|
||||
# compile the true block (as we think of it first, even it is second in sequential order)
|
||||
method.current true_block
|
||||
|
@ -5,7 +5,7 @@ module Ast
|
||||
start = Virtual::Label.new("while_start")
|
||||
method.add_code start
|
||||
is = condition.compile(method,message)
|
||||
branch = Virtual::ImplicitBranch.new "while"
|
||||
branch = Virtual::IsTrueBranch.new "while"
|
||||
merge = Virtual::Label.new(branch.name)
|
||||
branch.other = merge #false jumps to end of while
|
||||
method.add_code branch
|
||||
|
@ -31,7 +31,7 @@ module Virtual
|
||||
|
||||
# implicit means there is no explcit test involved.
|
||||
# normal ruby rules are false and nil are false, EVERYTHING else is true (and that includes 0)
|
||||
class ImplicitBranch < Branch
|
||||
class IsTrueBranch < Branch
|
||||
end
|
||||
|
||||
class UnconditionalBranch < Branch
|
||||
|
@ -65,7 +65,7 @@ def ofthen(n)
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@output = "---RETURN_MARKER- &2 !ruby/object:Virtual::CompiledMethodRETURN_MARKER name: :ofthenRETURN_MARKER args:RETURN_MARKER - !ruby/object:Virtual::ArgumentRETURN_MARKER name: :nRETURN_MARKER type: !ruby/object:Virtual::Mystery {}RETURN_MARKER locals:RETURN_MARKER - !ruby/object:Virtual::LocalRETURN_MARKER name: :isitRETURN_MARKER type: &3 !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 42RETURN_MARKER - &1 !ruby/object:Virtual::LocalRETURN_MARKER name: :maybenotRETURN_MARKER type: &4 !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 667RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: *1RETURN_MARKER blocks:RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthenRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodEnter {}RETURN_MARKER - !ruby/object:Virtual::ImplicitBranchRETURN_MARKER to: &5 !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthen_if_trueRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::FrameSetRETURN_MARKER name: :isitRETURN_MARKER value: *3RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthen_if_falseRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::FrameSetRETURN_MARKER name: :maybenotRETURN_MARKER value: *4RETURN_MARKER - !ruby/object:Virtual::UnconditionalBranchRETURN_MARKER to: &6 !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthen_if_mergeRETURN_MARKER branch: RETURN_MARKER codes: []RETURN_MARKER - *5RETURN_MARKER - *6RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthen_returnRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodReturn {}RETURN_MARKER current: *6RETURN_MARKER"
|
||||
@output = "---RETURN_MARKER- &2 !ruby/object:Virtual::CompiledMethodRETURN_MARKER name: :ofthenRETURN_MARKER args:RETURN_MARKER - !ruby/object:Virtual::ArgumentRETURN_MARKER name: :nRETURN_MARKER type: !ruby/object:Virtual::Mystery {}RETURN_MARKER locals:RETURN_MARKER - !ruby/object:Virtual::LocalRETURN_MARKER name: :isitRETURN_MARKER type: &3 !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 42RETURN_MARKER - &1 !ruby/object:Virtual::LocalRETURN_MARKER name: :maybenotRETURN_MARKER type: &4 !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 667RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: *1RETURN_MARKER blocks:RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthenRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodEnter {}RETURN_MARKER - !ruby/object:Virtual::IsTrueBranchRETURN_MARKER to: &5 !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthen_if_trueRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::FrameSetRETURN_MARKER name: :isitRETURN_MARKER value: *3RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthen_if_falseRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::FrameSetRETURN_MARKER name: :maybenotRETURN_MARKER value: *4RETURN_MARKER - !ruby/object:Virtual::UnconditionalBranchRETURN_MARKER to: &6 !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthen_if_mergeRETURN_MARKER branch: RETURN_MARKER codes: []RETURN_MARKER - *5RETURN_MARKER - *6RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :ofthen_returnRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodReturn {}RETURN_MARKER current: *6RETURN_MARKER"
|
||||
check
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user