adding receiver and a register abstraction

This commit is contained in:
Torsten Ruger
2014-06-06 21:49:03 +03:00
parent c59f22f11f
commit 6433a394e7
6 changed files with 56 additions and 23 deletions

View File

@ -6,7 +6,7 @@ module Boot
# set/get instance variable use it.
# This is just a placeholder, as we code this in ruby, but the instance methods need the definition before.
def index_of context , name = Vm::Integer
index_function = Vm::Function.new(:index_of , [Vm::Integer] , Vm::Integer )
index_function = Vm::Function.new(:index_of , Vm::Integer , [Vm::Integer] , Vm::Integer )
return index_function
end
@ -18,7 +18,7 @@ module Boot
# end
# The at_index is just "below" the api, somehting we need but don't want to expose, so we can't code the above in ruby
def _get_instance_variable context , name = Vm::Integer
get_function = Vm::Function.new(:_get_instance_variable , [Vm::Integer , Vm::Integer ] , Vm::Integer )
get_function = Vm::Function.new(:_get_instance_variable , Vm::Integer , [ Vm::Integer ] , Vm::Integer )
me = get_function.args[0]
var_name = get_function.args[1]
return_to = get_function.return_type

View File

@ -2,11 +2,11 @@ module Boot
class String
module ClassMethods
def get context , index = Vm::Integer
get_function = Vm::Function.new(:get , [Vm::Integer, Vm::Integer] , Vm::Integer )
get_function = Vm::Function.new(:get , Vm::Integer , [ Vm::Integer] , Vm::Integer )
return get_function
end
def set context , index = Vm::Integer , char = Vm::Integer
set_function = Vm::Function.new(:set , [Vm::Integer, Vm::Integer, Vm::Integer] , Vm::Integer )
set_function = Vm::Function.new(:set , Vm::Integer ,[Vm::Integer, Vm::Integer] , Vm::Integer )
return set_function
end
end