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
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 "double r #{r}" if r == :rr1
@symbol = r

View File

@ -20,8 +20,9 @@ module FakeMem
raise "Class not found #{vm_name}" unless clazz
self.set_layout clazz.object_layout
end
#TODO, this is copied from module Positioned, maybe avoid duplication ?
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
end
def set_position pos
@ -88,7 +89,9 @@ module Parfait
def to_s
Sof::Writer.write(self)
end
def inspect
to_s
end
end
class List
def mem_length

View File

@ -2,7 +2,7 @@ require_relative "type"
module Positioned
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
end
def set_position pos