fixing risc collection tests

This commit is contained in:
2019-08-12 16:12:17 +03:00
parent 9a2716280c
commit 9474932320
7 changed files with 77 additions and 31 deletions

View File

@ -21,12 +21,12 @@ module Mom
# classes have booted, now create a minimal set of functions
# minimal means only that which can not be coded in ruby
# Methods are grabbed from respective modules by sending the method name.
# This should return the implementation of the method (ie a method object),
# This should return the implementation of the method (ie a method compiler),
# not actually try to implement it(as that's impossible in ruby)
#
# When no main has been compiled, we will add an empty main (for testing)
#
def self.boot_functions(add_main = false)
# We create an empty main for init to jump to, if no code is compiled, that just returns
# See Builtin directory readme and module
def self.boot_functions()
# TODO go through the virtual parfait layer and adjust function names
# to what they really are
compilers = []
@ -37,8 +37,8 @@ module Mom
end
obj_type = space.get_type_by_class_name(:Object)
[ :get_internal_word , :set_internal_word , :_method_missing,
:exit , :__init__ ].each do |f|
[ :__init__ , :exit , :_method_missing, :get_internal_word ,
:set_internal_word ].each do |f|
compilers << compiler_for( obj_type , Object , f)
end

View File

@ -17,13 +17,13 @@ module Mom
# lazily instantiate the compilers for boot functions
# (in the hope of only booting the functions once)
def boot_compilers
@boot_compilers ||= Risc::Builtin.boot_functions
@boot_compilers ||= Mom::Builtin.boot_functions
end
# Return all compilers, namely the MethodCompilers passed in, plus the
# boot_function's compilers (boot_compilers)
def compilers
@method_compilers #+ boot_compilers
@method_compilers + boot_compilers
end
# collects constants from all compilers into one array
@ -37,8 +37,8 @@ module Mom
self
end
def to_risc( )
riscs = method_compilers.collect do | mom_c |
def to_risc( )
riscs = compilers.collect do | mom_c |
mom_c.to_risc
end
# to_risc all compilers