Sha256: 22405ebbc594d030c1bb62f142dfce8e7954e84020f12ade32a4863adf2f4c4b

Contents?: true

Size: 544 Bytes

Versions: 17

Compression:

Stored size: 544 Bytes

Contents

module Finitio
  module Syntax
    module SubType
      include Node

      capture :rel_type, :constraint_def

      def compile(factory)
        s = rel_type.compile(factory)
        if c = constraint_def
          factory.subtype(s, c.compile(factory))
        else
          s
        end
      end

      def to_ast
        if c = constraint_def
          [:sub_type, rel_type.to_ast] + constraint_def.to_ast
        else
          rel_type.to_ast
        end
      end

    end # module SubType
  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/sub_type.rb
finitio-0.11.4 lib/finitio/syntax/type/sub_type.rb
finitio-0.11.3 lib/finitio/syntax/type/sub_type.rb
finitio-0.11.2 lib/finitio/syntax/type/sub_type.rb
finitio-0.11.1 lib/finitio/syntax/type/sub_type.rb
finitio-0.10.0 lib/finitio/syntax/type/sub_type.rb
finitio-0.9.1 lib/finitio/syntax/type/sub_type.rb
finitio-0.9.0 lib/finitio/syntax/type/sub_type.rb
finitio-0.8.0 lib/finitio/syntax/type/sub_type.rb
finitio-0.7.0 lib/finitio/syntax/type/sub_type.rb
finitio-0.7.0.pre.rc4 lib/finitio/syntax/type/sub_type.rb
finitio-0.7.0.pre.rc3 lib/finitio/syntax/type/sub_type.rb
finitio-0.7.0.pre.rc2 lib/finitio/syntax/type/sub_type.rb
finitio-0.7.0.pre.rc1 lib/finitio/syntax/type/sub_type.rb
finitio-0.6.1 lib/finitio/syntax/type/sub_type.rb
finitio-0.6.0 lib/finitio/syntax/type/sub_type.rb
finitio-0.5.2 lib/finitio/syntax/type/sub_type.rb