Fix vool assignments after call rework

also small fix for if and return, as they need to execute sneds and yields (not just sends), so testing for Call not SendStatement
This commit is contained in:
2019-08-16 20:39:08 +03:00
parent e6c30d98fb
commit 7c91a08d5b
9 changed files with 103 additions and 44 deletions

View File

@ -2,7 +2,18 @@ module Vool
class Statements < Statement
attr_reader :statements
def initialize(statements)
@statements = statements
case statements
when nil
@statements = []
when Array
@statements = statements
when Statement
@statements = statements.statements
when Statement
@statements = [statements]
else
raise "Invalid class, must be Statement or Array, not #{statements.class}"
end
end
def empty?
@ -24,7 +35,11 @@ module Vool
@statements[i]
end
def <<(o)
@statements << o
if(o.is_a?(Statements))
o.each {|s| @statements << s }
else
@statements << o
end
self
end
def prepend(o)