small fixes

This commit is contained in:
Torsten Ruger 2015-05-29 12:33:59 +03:00
parent a46b2d5c56
commit 73e5ec550a
3 changed files with 6 additions and 6 deletions

View File

@ -10,9 +10,6 @@ module Register
attr_accessor :symbol attr_accessor :symbol
def initialize r def initialize r
if( r.is_a? Fixnum)
r = "r#{r}".to_sym
end
raise "wrong type for register init #{r}" unless r.is_a? Symbol raise "wrong type for register init #{r}" unless r.is_a? Symbol
raise "double r #{r}" if r == :rr1 raise "double r #{r}" if r == :rr1
@symbol = r @symbol = r

View File

@ -20,8 +20,9 @@ module FakeMem
raise "Class not found #{vm_name}" unless clazz raise "Class not found #{vm_name}" unless clazz
self.set_layout clazz.object_layout self.set_layout clazz.object_layout
end end
#TODO, this is copied from module Positioned, maybe avoid duplication ?
def position def position
raise "position accessed but not set at #{length} for #{self.inspect[0...500]}" if @position == nil raise "position accessed but not set at #{mem_length} for #{self.inspect[0...1000]}" if @position == nil
@position @position
end end
def set_position pos def set_position pos
@ -88,7 +89,9 @@ module Parfait
def to_s def to_s
Sof::Writer.write(self) Sof::Writer.write(self)
end end
def inspect
to_s
end
end end
class List class List
def mem_length def mem_length

View File

@ -2,7 +2,7 @@ require_relative "type"
module Positioned module Positioned
def position def position
raise "position accessed but not set at #{length} for #{self.inspect[0...500]}" if @position == nil raise "position accessed but not set at #{mem_length} for #{self.inspect[0...500]}" if @position == nil
@position @position
end end
def set_position pos def set_position pos