remove positioned copy paste
This commit is contained in:
parent
575d19cb02
commit
5b3045e42a
@ -22,23 +22,6 @@ module FakeMem
|
||||
raise "Layout not set #{vm_name}" unless clazz.object_layout
|
||||
self.set_layout clazz.object_layout
|
||||
end
|
||||
#TODO, this is copied from module Positioned, maybe avoid duplication ?
|
||||
def position
|
||||
if @position.nil?
|
||||
str = "IN machine #{Virtual.machine.objects.include?(self)}\n"
|
||||
raise str + "position not set for #{self.class} at #{word_length} for #{self.inspect[0...100]}"
|
||||
end
|
||||
@position
|
||||
end
|
||||
def set_position pos
|
||||
raise "Setting of nil not allowed" if pos.nil?
|
||||
# resetting of position used to be error, but since relink and dynamic instruction size it is ok.
|
||||
# in measures (of 32)
|
||||
if @position != nil and ((@position - pos).abs > 32)
|
||||
raise "position set again #{pos}!=#{@position} for #{self.class}"
|
||||
end
|
||||
@position = pos
|
||||
end
|
||||
end
|
||||
module Virtual
|
||||
def self.new_list array
|
||||
@ -99,6 +82,7 @@ module Parfait
|
||||
class Object
|
||||
include FakeMem
|
||||
include Padding
|
||||
include Positioned
|
||||
|
||||
# these internal functions are _really_ internal
|
||||
# they respresent the smallest code needed to build larger functionality
|
||||
|
@ -2,12 +2,14 @@ require_relative "type"
|
||||
|
||||
module Positioned
|
||||
def position
|
||||
if @position == nil
|
||||
raise "position accessed but not set at #{word_length} for #{self.inspect[0...500]}"
|
||||
if @position.nil?
|
||||
str = "IN machine #{Virtual.machine.objects.include?(self)}\n"
|
||||
raise str + "position not set for #{self.class} at #{word_length} for #{self.inspect[0...100]}"
|
||||
end
|
||||
@position
|
||||
end
|
||||
def set_position pos
|
||||
raise "Setting of nil not allowed" if pos.nil?
|
||||
# resetting of position used to be error, but since relink and dynamic instruction size it is ok.
|
||||
# in measures (of 32)
|
||||
if @position != nil and ((@position - pos).abs > 32)
|
||||
@ -15,5 +17,4 @@ module Positioned
|
||||
end
|
||||
@position = pos
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user