Sha256: 2b08de528b93bb6bf95696c87c12e9ad41da1df576dc8356a41e91e1a2fdd593
Contents?: true
Size: 817 Bytes
Versions: 2
Compression:
Stored size: 817 Bytes
Contents
module Finitio module Syntax module AdType include Support def compile(factory) name = builtin_type_name clazz = name ? resolve_ruby_const(name.to_s) : nil factory.adt(clazz, compile_contracts(factory, clazz)) end def compile_contracts(factory, clazz) contracts = {} captures[:contract].each do |node| contract = node.compile(factory, clazz) contracts.merge!(contract) do |k,_,_| raise Error, "Duplicate contract name `#{k}`" end end contracts end def to_ast [ :ad_type, builtin_type_name ? builtin_type_name.to_s : nil ] + captures[:contract].map(&:to_ast) end end # module AdType end # module Syntax end # module Finitio
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
finitio-0.4.1 | lib/finitio/syntax/ad_type.rb |
finitio-0.4.0 | lib/finitio/syntax/ad_type.rb |