making the third arg of block init explicit (not optional)
This commit is contained in:
parent
7ca3207b3e
commit
e9fc8ac6aa
@ -20,7 +20,7 @@ module Vm
|
||||
|
||||
class Block < Code
|
||||
|
||||
def initialize(name , function , next_block = nil)
|
||||
def initialize(name , function , next_block )
|
||||
super()
|
||||
@function = function
|
||||
@name = name.to_sym
|
||||
@ -138,12 +138,14 @@ module Vm
|
||||
end
|
||||
|
||||
private
|
||||
# helper for determining reachable blocks
|
||||
def add_next ret
|
||||
return if @next.nil?
|
||||
return if ret.include? @next
|
||||
ret << @next
|
||||
ret + @next.reachable
|
||||
end
|
||||
# helper for determining reachable blocks
|
||||
def add_branch ret
|
||||
return if @branch.nil?
|
||||
return if ret.include? @branch
|
||||
|
@ -33,10 +33,10 @@ module Vm
|
||||
@context.current_class = get_or_create_class :Object
|
||||
#global objects (data)
|
||||
@objects = []
|
||||
@entry = Core::Kernel::main_start Vm::Block.new("main_entry",nil)
|
||||
@entry = Core::Kernel::main_start Vm::Block.new("main_entry",nil,nil)
|
||||
#main gets executed between entry and exit
|
||||
@main = Block.new("main",nil)
|
||||
@exit = Core::Kernel::main_exit Vm::Block.new("main_exit",nil)
|
||||
@main = Block.new("main",nil,nil)
|
||||
@exit = Core::Kernel::main_exit Vm::Block.new("main_exit",nil,nil)
|
||||
boot_classes
|
||||
end
|
||||
attr_reader :context , :main , :classes , :entry , :exit
|
||||
|
@ -48,7 +48,7 @@ module Vm
|
||||
end
|
||||
end
|
||||
set_return return_type
|
||||
@exit = Core::Kernel::function_exit( Vm::Block.new("exit" , self) , name )
|
||||
@exit = Core::Kernel::function_exit( Vm::Block.new("exit" , self , nil) , name )
|
||||
@return = Block.new("return", self , @exit)
|
||||
@body = Block.new("body", self , @return)
|
||||
@entry = Core::Kernel::function_entry( Vm::Block.new("entry" , self , @body) ,name )
|
||||
|
Loading…
x
Reference in New Issue
Block a user