using compiler_for to create all building compilers

unify api, create defaults and especially pass the right types into the
typed method creation
This commit is contained in:
Torsten Ruger
2018-03-18 22:08:35 +05:30
parent e7b878a353
commit 0813312ddc
7 changed files with 27 additions and 25 deletions

View File

@ -4,20 +4,21 @@ module Risc
module Integer
module ClassMethods
include AST::Sexp
include CompileHelper
def mod4 context
compiler = Risc::MethodCompiler.create_method(:Integer,:mod4 ).init_method
compiler = compiler_for(:Integer,:mod4 ,{})
return compiler.method
end
def putint context
compiler = Risc::MethodCompiler.create_method(:Integer,:putint ).init_method
compiler = compiler_for(:Integer,:putint ,{})
return compiler.method
end
def div10 context
s = "div_10"
compiler = Risc::MethodCompiler.create_method(:Integer,:div10 ).init_method
compiler = compiler_for(:Integer,:div10 ,{})
me = compiler.add_known( :receiver )
tmp = compiler.add_known( :receiver )
q = compiler.add_known( :receiver )