Sha256: 48c1b078067115a985eef9b00efbfe633ebbe7c9495ed2b9cebbb1731238d3b5
Contents?: true
Size: 1.15 KB
Versions: 26
Compression:
Stored size: 1.15 KB
Contents
Foobara.require_project_file("type_declarations", "desugarizer") Foobara.require_project_file("type_declarations", "handlers/extend_associative_array_type_declaration") module Foobara module TypeDeclarations module Handlers class ExtendArrayTypeDeclaration < ExtendAssociativeArrayTypeDeclaration # TODO: make a quick way to convert a couple simple procs into a transformer class ArrayDesugarizer < TypeDeclarations::Desugarizer def applicable?(sugary_type_declaration) sugary_type_declaration.is_a?(::Array) && sugary_type_declaration.size <= 1 end def desugarize(sugary_type_declaration) strict_type_declaration = { type: :array, _desugarized: { type_absolutified: true } } unless sugary_type_declaration.empty? element_type_declaration = sugary_type_declaration.first handler = type_declaration_handler_for(element_type_declaration) strict_type_declaration[:element_type_declaration] = handler.desugarize(element_type_declaration) end strict_type_declaration end end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems