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

@ -1,5 +1,3 @@
require_relative "compile_helper"
module Risc
module Builtin
class Object
@ -10,7 +8,7 @@ module Risc
# return is stored in return_value
# (this method returns a new method off course, like all builtin)
def get_internal_word context
compiler = compiler_for(:Object , :get_internal_word )
compiler = compiler_for(:Object , :get_internal_word ,{at: :Integer})
source = "get_internal_word"
me , index = self_and_int_arg(compiler,source)
# reduce me to me[index]
@ -23,7 +21,7 @@ module Risc
# self[index] = val basically. Index is the first arg , value the second
# no return
def set_internal_word context
compiler = compiler_for(:Object , :set_internal_word , {:value => :Object} )
compiler = compiler_for(:Object , :set_internal_word , {at: :Integer, :value => :Object} )
source = "set_internal_word"
me , index = self_and_int_arg(compiler,source)
value = load_int_arg_at(compiler,source , 2)