rename to to array function to to_arr

This commit is contained in:
Torsten Ruger 2017-01-04 21:32:09 +02:00
parent 88eae0e6f0
commit f2c4e542ac
4 changed files with 6 additions and 6 deletions

View File

@ -71,9 +71,9 @@ module Register
ret ret
end end
def to_ac labels = [] def to_arr labels = []
ret = [self.class] ret = [self.class]
ret += self.next.to_ac(labels) if self.next ret += self.next.to_arr(labels) if self.next
ret ret
end end

View File

@ -20,9 +20,9 @@ module Register
ret ret
end end
def to_ac labels = [] def to_arr( labels = [] )
ret = super(labels) ret = super(labels)
ret += self.label.to_ac(labels) if self.label ret += self.label.to_arr(labels) if self.label
ret ret
end end

View File

@ -27,7 +27,7 @@ module Register
@name.split(".").length == 2 @name.split(".").length == 2
end end
def to_ac labels = [] def to_arr labels = []
return [] if labels.include?(self) return [] if labels.include?(self)
labels << self labels << self
super super

View File

@ -54,7 +54,7 @@ module Register
@instruction.replace_next @label @instruction.replace_next @label
assert_equal @label, @instruction.last assert_equal @label, @instruction.last
assert_equal @label, @instruction.next assert_equal @label, @instruction.next
assert_equal 2 , @instruction.length , @instruction.to_ac assert_equal 2 , @instruction.length , @instruction.to_arr
end end
def test_each_label1 def test_each_label1
@instruction.set_next @label @instruction.set_next @label