small fixes

This commit is contained in:
Torsten Ruger 2016-12-27 20:34:11 +02:00
parent b9b05378f5
commit aaa94f0743
5 changed files with 14 additions and 6 deletions

View File

@ -26,7 +26,7 @@ module Register
compiler = compiler_for(:Object , :set_internal_word , {:value => :Object} ) compiler = compiler_for(:Object , :set_internal_word , {:value => :Object} )
source = "set_internal_word" source = "set_internal_word"
me , index = self_and_int_arg(compiler,source) 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 # do the set
compiler.add_code RegToSlot.new( source , value , me , index) compiler.add_code RegToSlot.new( source , value , me , index)

View File

@ -34,9 +34,12 @@ module Register
# no return # no return
def set_internal_byte context def set_internal_byte context
compiler = compiler_for(:Word, :set_internal_byte , {:value => :Integer} ) 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" source = "set_internal_byte"
me , index = self_and_int_arg(compiler,source) 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 # do the set
compiler.add_code RegToByte.new( source , value , me , index) compiler.add_code RegToByte.new( source , value , me , index)
return compiler.method return compiler.method

View File

@ -28,7 +28,7 @@ module Register
attr_accessor :register , :array , :index attr_accessor :register , :array , :index
def to_s def to_s
"#{self.class.name}: #{array}[#{index}] -> #{register}" "#{self.class.name}: #{register} -> #{array}[#{index}]"
end end
end end

View File

@ -60,16 +60,20 @@ module Parfait
hash_code.to_sym hash_code.to_sym
end end
def initialize( object_class , hash = nil) def initialize( object_class , hash = {})
super() super()
private_add_instance_variable :type ,:Type private_add_instance_variable :type ,:Type
self.object_class = object_class self.object_class = object_class
hash.each do |name , type| hash.each do |name , type|
private_add_instance_variable(name , type) unless name == :type private_add_instance_variable(name , type) unless name == :type
end if hash end
self.instance_methods = List.new self.instance_methods = List.new
end end
def to_s
""
end
def methods def methods
m = self.instance_methods m = self.instance_methods
return m if m return m if m

View File

@ -1,7 +1,8 @@
require_relative "test_add" require_relative "test_add"
require_relative "test_change" require_relative "test_change"
require_relative "test_byte_to_reg" 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_puts"
require_relative "test_plus" require_relative "test_plus"
require_relative "test_mult" require_relative "test_mult"