fix the statement moming

This commit is contained in:
Torsten Ruger
2018-11-02 17:27:46 -07:00
parent 4ff84133d2
commit fb6a1a0e01
4 changed files with 16 additions and 6 deletions

View File

@ -87,6 +87,8 @@ module RubyX
@vool = ruby_tree.to_vool
return @vool
end
# TODO: should check if this works with reopening classes
# or whether we need to unify the vool for a class
unless(@vool.is_a?(Vool::ScopeStatement))
@vool = Vool::ScopeStatement.new([@vool])
end

View File

@ -31,15 +31,19 @@ module Vool
@statements = [o] + @statements
end
# create mom instructions
# to_mom all the statements. Append subsequent ones to the first, and return the
# first.
#
# For ClassStatements this creates and returns a MomCompiler
#
def to_mom( compiler )
raise "Empty list ? #{statements.length}" if empty?
stats = @statements.dup
flat = stats.shift.to_mom(compiler)
first = stats.shift.to_mom(compiler)
while( nekst = stats.shift )
flat.append nekst.to_mom(compiler)
first.append nekst.to_mom(compiler)
end
flat
first
end
def each(&block)