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

@ -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