add object method missing as sys exit

functions get added twice and thus removed once
remove restriction for now
This commit is contained in:
Torsten Ruger
2018-04-02 16:49:30 +03:00
parent fb29fb6431
commit 87eee0b66e
5 changed files with 10 additions and 11 deletions

View File

@ -170,7 +170,7 @@ module Risc
space_class.instance_type.add_method Builtin::Space.send(:main, nil)
obj = space.get_class_by_name(:Object)
[ :get_internal_word , :set_internal_word ].each do |f|
[ :get_internal_word , :set_internal_word , :_method_missing].each do |f|
obj.instance_type.add_method Builtin::Object.send(f , nil)
end
obj = space.get_class_by_name(:Kernel)

View File

@ -31,13 +31,13 @@ module Risc
return compiler.method
end
def exit context
def exit( context )
compiler = compiler_for(:Kernel,:exit ,{})
emit_syscall( compiler , :exit )
return compiler.method
end
def emit_syscall compiler , name
def emit_syscall( compiler , name )
save_message( compiler )
compiler.add_code Syscall.new("emit_syscall(#{name})", name )
restore_message(compiler)

View File

@ -33,6 +33,13 @@ module Risc
return compiler.method
end
# every object needs a method missing.
# Even if it's just this one, sys_exit (later raise)
def _method_missing( context )
compiler = compiler_for(:Object,:method_missing ,{})
Risc::Builtin::Kernel.emit_syscall( compiler , :exit )
return compiler.method
end
end
extend ClassMethods
end