Module: Qrb::Syntax::UnionType

Defined in:
lib/qrb/syntax/union_type.rb

Instance Method Summary collapse

Instance Method Details

#compile(factory) ⇒ Object



5
6
7
8
# File 'lib/qrb/syntax/union_type.rb', line 5

def compile(factory)
  cds = captures[:sub_type].map{|x| x.compile(factory) }
  factory.union(cds)
end

#to_astObject



10
11
12
# File 'lib/qrb/syntax/union_type.rb', line 10

def to_ast
  captures[:sub_type].map(&:to_ast).unshift(:union_type)
end