test compatibility layer
test from and to std/parfait objects for list and word for now moved some of that code to virtual, out of parfait
This commit is contained in:
@ -84,6 +84,18 @@ module Parfait
|
||||
return if old_length >= len
|
||||
internal_object_grow(len + 1)
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
# this should call parfait get_class, alas that is not implemented yet
|
||||
return false if other.class != self.class
|
||||
return false if other.get_length != self.get_length
|
||||
index = self.get_length
|
||||
while(index > 0)
|
||||
return false if other.get(index) != self.get(index)
|
||||
index = index - 1
|
||||
end
|
||||
return true
|
||||
end
|
||||
#many basic List functions can not be defined in ruby, such as
|
||||
# get/set/length/add/delete
|
||||
# so they must be defined as CompiledMethods in Builtin::Kernel
|
||||
|
@ -60,7 +60,7 @@ module Parfait
|
||||
|
||||
def create_class name , variable_names
|
||||
c = Class.new_object(name)
|
||||
c.set_instance_names Parfait.new_list(variable_names)
|
||||
c.set_instance_names Virtual.new_list(variable_names)
|
||||
@classes[name] = c
|
||||
end
|
||||
|
||||
|
@ -80,6 +80,19 @@ module Parfait
|
||||
def to_sof
|
||||
"Parfait::Word('#{to_s}')"
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
# this should call parfait get_class, alas that is not implemented yet
|
||||
return false if other.class != self.class
|
||||
return false if other.length != self.length
|
||||
index = self.length
|
||||
while(index > 0)
|
||||
return false if other.get_char(index) != self.get_char(index)
|
||||
index = index - 1
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def result= value
|
||||
raise "called"
|
||||
class_for(MoveInstruction).new(value , self , :opcode => :mov)
|
||||
|
Reference in New Issue
Block a user