shortening some methods, removing object prefix
This commit is contained in:
parent
d2c670b31a
commit
4cadfc9ea9
@ -205,7 +205,7 @@ module Interpreter
|
|||||||
else
|
else
|
||||||
raise "unimplemented '#{@instruction.operator}' #{@instruction}"
|
raise "unimplemented '#{@instruction.operator}' #{@instruction}"
|
||||||
end
|
end
|
||||||
puts "#{@instruction} == #{result} (#{left}|#{right})"
|
#puts "#{@instruction} == #{result} (#{left}|#{right})"
|
||||||
right = set_register(@instruction.left , result)
|
right = set_register(@instruction.left , result)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -20,7 +20,7 @@ module Parfait
|
|||||||
attribute :next_frame
|
attribute :next_frame
|
||||||
|
|
||||||
def self.offset
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -30,7 +30,7 @@ module Parfait
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.offset
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -73,7 +73,7 @@ module Parfait
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_instance_variables
|
def get_instance_variables
|
||||||
get_layout().object_instance_names
|
get_layout().instance_names
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_instance_variable name
|
def get_instance_variable name
|
||||||
|
@ -23,7 +23,7 @@ module Register
|
|||||||
layout = object.get_layout
|
layout = object.get_layout
|
||||||
keep(layout , depth + 1)
|
keep(layout , depth + 1)
|
||||||
return if object.is_a? Symbol
|
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}"
|
#puts "Keep #{name} for #{object.class}"
|
||||||
inst = object.get_instance_variable name
|
inst = object.get_instance_variable name
|
||||||
keep(inst , depth + 1)
|
keep(inst , depth + 1)
|
||||||
|
@ -12,11 +12,11 @@ class TestAttributes < MiniTest::Test
|
|||||||
end
|
end
|
||||||
def test_message_layout_first
|
def test_message_layout_first
|
||||||
@layout.object_class = :next_message
|
@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
|
assert_equal :next_message , @layout.object_class
|
||||||
end
|
end
|
||||||
def test_message_name_nil
|
def test_message_name_nil
|
||||||
last = @layout.object_instance_names.last
|
last = @layout.instance_names.last
|
||||||
assert_equal :name , last
|
assert_equal :name , last
|
||||||
assert_equal nil , @mess.name
|
assert_equal nil , @mess.name
|
||||||
end
|
end
|
||||||
|
@ -24,10 +24,6 @@ class TestLayout < MiniTest::Test
|
|||||||
assert_equal @mess.get_layout , @mess.internal_object_get(0) , "mess"
|
assert_equal @mess.get_layout , @mess.internal_object_get(0) , "mess"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_forbidden_index_of
|
|
||||||
assert_raises(RuntimeError) { @mess.get_layout.index_of(:name)}
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_inspect
|
def test_inspect
|
||||||
assert @mess.get_layout.inspect.start_with?("Layout")
|
assert @mess.get_layout.inspect.start_with?("Layout")
|
||||||
end
|
end
|
||||||
@ -37,12 +33,12 @@ class TestLayout < MiniTest::Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_length
|
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
|
end
|
||||||
|
|
||||||
def test_no_index_below_1
|
def test_no_index_below_1
|
||||||
layout = @mess.get_layout
|
layout = @mess.get_layout
|
||||||
names = layout.object_instance_names
|
names = layout.instance_names
|
||||||
assert_equal 8 , names.get_length , names.inspect
|
assert_equal 8 , names.get_length , names.inspect
|
||||||
names.each do |n|
|
names.each do |n|
|
||||||
assert layout.variable_index(n) >= 1
|
assert layout.variable_index(n) >= 1
|
||||||
@ -54,7 +50,7 @@ class TestLayout < MiniTest::Test
|
|||||||
assert_equal Parfait::Class , oc.class
|
assert_equal Parfait::Class , oc.class
|
||||||
layout = oc.object_layout
|
layout = oc.object_layout
|
||||||
assert_equal Parfait::Layout , layout.class
|
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
|
assert_equal layout.first , :layout
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ class TestObject < MiniTest::Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_object_create
|
def test_object_create
|
||||||
assert_equal 1 , @object.get_layout.object_instance_length
|
assert_equal 1 , @object.get_layout.instance_length
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_empty_object_doesnt_return
|
def test_empty_object_doesnt_return
|
||||||
|
Loading…
Reference in New Issue
Block a user