diff --git a/lib/register/builtin/object.rb b/lib/register/builtin/object.rb index 10534c7d..0a1f36ed 100644 --- a/lib/register/builtin/object.rb +++ b/lib/register/builtin/object.rb @@ -26,7 +26,7 @@ module Register compiler = compiler_for(:Object , :set_internal_word , {:value => :Object} ) source = "set_internal_word" me , index = self_and_int_arg(compiler,source) - value = load_arg_at(compiler,source , 2) + value = load_int_arg_at(compiler,source , 2) # do the set compiler.add_code RegToSlot.new( source , value , me , index) diff --git a/lib/register/builtin/word.rb b/lib/register/builtin/word.rb index 4d5e6af7..3a0eb5a6 100644 --- a/lib/register/builtin/word.rb +++ b/lib/register/builtin/word.rb @@ -34,9 +34,12 @@ module Register # no return def set_internal_byte context compiler = compiler_for(:Word, :set_internal_byte , {:value => :Integer} ) + args = compiler.method.arguments + len = args.instance_length + raise "Compiler arg number mismatch, method=#{args} " if len != 3 source = "set_internal_byte" me , index = self_and_int_arg(compiler,source) - value = load_arg_at(compiler , source , 2 ) + value = load_int_arg_at(compiler , source , 2 ) # do the set compiler.add_code RegToByte.new( source , value , me , index) return compiler.method diff --git a/lib/register/instructions/setter.rb b/lib/register/instructions/setter.rb index 783e5a8f..e7935e07 100644 --- a/lib/register/instructions/setter.rb +++ b/lib/register/instructions/setter.rb @@ -28,7 +28,7 @@ module Register attr_accessor :register , :array , :index def to_s - "#{self.class.name}: #{array}[#{index}] -> #{register}" + "#{self.class.name}: #{register} -> #{array}[#{index}]" end end diff --git a/lib/typed/parfait/type.rb b/lib/typed/parfait/type.rb index e0d28db7..d9e6d80a 100644 --- a/lib/typed/parfait/type.rb +++ b/lib/typed/parfait/type.rb @@ -60,16 +60,20 @@ module Parfait hash_code.to_sym end - def initialize( object_class , hash = nil) + def initialize( object_class , hash = {}) super() private_add_instance_variable :type ,:Type self.object_class = object_class hash.each do |name , type| private_add_instance_variable(name , type) unless name == :type - end if hash + end self.instance_methods = List.new end + def to_s + "" + end + def methods m = self.instance_methods return m if m diff --git a/test/register/interpreter/test_all.rb b/test/register/interpreter/test_all.rb index 5a1e0eaf..64c60c33 100644 --- a/test/register/interpreter/test_all.rb +++ b/test/register/interpreter/test_all.rb @@ -1,7 +1,8 @@ require_relative "test_add" require_relative "test_change" require_relative "test_byte_to_reg" -require_relative "test_if" +require_relative "test_called_if" +require_relative "test_simple_if" require_relative "test_puts" require_relative "test_plus" require_relative "test_mult"