Sha256: 39b9b1bbe6204f71848506f8c703f2ff43277c29b288b38ea732cecc11d49fbd

Contents?: true

Size: 435 Bytes

Versions: 17

Compression:

Stored size: 435 Bytes

Contents

module Finitio
  module Syntax
    module UnionType
      include Node

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

      def to_ast
        cds = captures[:sub_type].map(&:to_ast)
        cds.size == 1 ? cds.first : cds.unshift(:union_type)
      end

    end # module UnionType
  end # module Syntax
end # module Finitio

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
finitio-0.12.0 lib/finitio/syntax/type/union_type.rb
finitio-0.11.4 lib/finitio/syntax/type/union_type.rb
finitio-0.11.3 lib/finitio/syntax/type/union_type.rb
finitio-0.11.2 lib/finitio/syntax/type/union_type.rb
finitio-0.11.1 lib/finitio/syntax/type/union_type.rb
finitio-0.10.0 lib/finitio/syntax/type/union_type.rb
finitio-0.9.1 lib/finitio/syntax/type/union_type.rb
finitio-0.9.0 lib/finitio/syntax/type/union_type.rb
finitio-0.8.0 lib/finitio/syntax/type/union_type.rb
finitio-0.7.0 lib/finitio/syntax/type/union_type.rb
finitio-0.7.0.pre.rc4 lib/finitio/syntax/type/union_type.rb
finitio-0.7.0.pre.rc3 lib/finitio/syntax/type/union_type.rb
finitio-0.7.0.pre.rc2 lib/finitio/syntax/type/union_type.rb
finitio-0.7.0.pre.rc1 lib/finitio/syntax/type/union_type.rb
finitio-0.6.1 lib/finitio/syntax/type/union_type.rb
finitio-0.6.0 lib/finitio/syntax/type/union_type.rb
finitio-0.5.2 lib/finitio/syntax/type/union_type.rb