shortening some methods, removing object prefix

This commit is contained in:
Torsten Ruger 2015-10-26 12:58:38 +02:00
parent d2c670b31a
commit 4cadfc9ea9
8 changed files with 11 additions and 15 deletions

View File

@ -205,7 +205,7 @@ module Interpreter
else
raise "unimplemented '#{@instruction.operator}' #{@instruction}"
end
puts "#{@instruction} == #{result} (#{left}|#{right})"
#puts "#{@instruction} == #{result} (#{left}|#{right})"
right = set_register(@instruction.left , result)
true
end

View File

@ -20,7 +20,7 @@ module Parfait
attribute :next_frame
def self.offset
1 + Space.object_space.get_class_by_name(:Frame).object_layout.object_instance_length
1 + Space.object_space.get_class_by_name(:Frame).object_layout.instance_length
end
end

View File

@ -30,7 +30,7 @@ module Parfait
end
def self.offset
1 + Space.object_space.get_class_by_name(:Message).object_layout.object_instance_length
1 + Space.object_space.get_class_by_name(:Message).object_layout.instance_length
end
end
end

View File

@ -73,7 +73,7 @@ module Parfait
end
def get_instance_variables
get_layout().object_instance_names
get_layout().instance_names
end
def get_instance_variable name

View File

@ -23,7 +23,7 @@ module Register
layout = object.get_layout
keep(layout , depth + 1)
return if object.is_a? Symbol
layout.object_instance_names.each do |name|
layout.instance_names.each do |name|
#puts "Keep #{name} for #{object.class}"
inst = object.get_instance_variable name
keep(inst , depth + 1)

View File

@ -12,11 +12,11 @@ class TestAttributes < MiniTest::Test
end
def test_message_layout_first
@layout.object_class = :next_message
assert_equal :layout , @layout.object_instance_names.first
assert_equal :layout , @layout.instance_names.first
assert_equal :next_message , @layout.object_class
end
def test_message_name_nil
last = @layout.object_instance_names.last
last = @layout.instance_names.last
assert_equal :name , last
assert_equal nil , @mess.name
end

View File

@ -24,10 +24,6 @@ class TestLayout < MiniTest::Test
assert_equal @mess.get_layout , @mess.internal_object_get(0) , "mess"
end
def test_forbidden_index_of
assert_raises(RuntimeError) { @mess.get_layout.index_of(:name)}
end
def test_inspect
assert @mess.get_layout.inspect.start_with?("Layout")
end
@ -37,12 +33,12 @@ class TestLayout < MiniTest::Test
end
def test_length
assert_equal 8 , @mess.get_layout.object_instance_length , @mess.get_layout.inspect
assert_equal 8 , @mess.get_layout.instance_length , @mess.get_layout.inspect
end
def test_no_index_below_1
layout = @mess.get_layout
names = layout.object_instance_names
names = layout.instance_names
assert_equal 8 , names.get_length , names.inspect
names.each do |n|
assert layout.variable_index(n) >= 1
@ -54,7 +50,7 @@ class TestLayout < MiniTest::Test
assert_equal Parfait::Class , oc.class
layout = oc.object_layout
assert_equal Parfait::Layout , layout.class
assert_equal 1 , layout.object_instance_names.get_length
assert_equal 1 , layout.instance_names.get_length
assert_equal layout.first , :layout
end

View File

@ -7,7 +7,7 @@ class TestObject < MiniTest::Test
end
def test_object_create
assert_equal 1 , @object.get_layout.object_instance_length
assert_equal 1 , @object.get_layout.instance_length
end
def test_empty_object_doesnt_return