fix block initialization
This commit is contained in:
parent
e7b8f2fcc8
commit
f91c9fabe8
@ -12,6 +12,7 @@ module Virtual
|
||||
def initialize(name , method )
|
||||
super()
|
||||
@method = method
|
||||
raise "Method is not Method, but #{method.class}" unless method == :dummy or method.is_a?(Parfait::Method)
|
||||
@name = name.to_sym
|
||||
@branch = nil
|
||||
@codes = []
|
||||
|
@ -123,7 +123,7 @@ module Virtual
|
||||
return self
|
||||
end
|
||||
boot_parfait!
|
||||
@init = Block.new("init",nil)
|
||||
@init = Block.new("init", :dummy )
|
||||
@init.add_code Virtual::VirtualMain.new( self.space.get_init )
|
||||
@booted = true
|
||||
self
|
||||
|
@ -46,7 +46,7 @@ module Virtual
|
||||
# just passing the method object in for Instructions to make decisions (later)
|
||||
def initialize method , return_type = Virtual::Unknown
|
||||
# first block we have to create with .new , as new_block assumes a current
|
||||
enter = Block.new( "enter" , self ).add_code(MethodEnter.new( method ))
|
||||
enter = Block.new( "enter" , method ).add_code(MethodEnter.new( method ))
|
||||
@return_type = return_type
|
||||
@blocks = [enter]
|
||||
@current = enter
|
||||
@ -110,7 +110,7 @@ module Virtual
|
||||
# In code generation , the new_block is written after this one, ie zero runtime cost
|
||||
# This does _not_ change the insertion point, that has do be done with insert_at(block)
|
||||
def new_block new_name
|
||||
new_b = Block.new( new_name , self )
|
||||
new_b = Block.new( new_name , @blocks.first.method )
|
||||
index = @blocks.index( @current )
|
||||
@blocks.insert( index + 1 , new_b ) # + one because we want the ne after the insert_at
|
||||
return new_b
|
||||
|
Loading…
Reference in New Issue
Block a user