move common statements into its only use in vool

This commit is contained in:
Torsten Ruger
2018-03-15 20:40:21 +05:30
parent 79bf416e58
commit ad4690d719
6 changed files with 37 additions and 44 deletions

View File

@ -9,7 +9,6 @@ module Common
@next = nekst
nekst
end
alias :<< :set_next
# during translation we replace one by one
def replace_next( nekst )
@ -44,6 +43,7 @@ module Common
def append( code )
last.set_next code
end
alias :<< :append
def length( labels = [] )
ret = 1

View File

@ -1,35 +0,0 @@
module Common
#extracted to resuse
module Statements
attr_reader :statements
def initialize(statements)
@statements = statements
end
def empty?
@statements.empty?
end
def single?
@statements.length == 1
end
def first
@statements.first
end
def last
@statements.last
end
def length
@statements.length
end
def [](i)
@statements[i]
end
def <<(o)
@statements << o
self
end
def add_array(a)
@statements += a
end
end
end