class Dhallish::Ast::RecordTypeNode

Attributes

hash[RW]

Public Class Methods

new(hash) click to toggle source
# File lib/ast.rb, line 401
def initialize(hash)
        @hash = hash
end

Public Instance Methods

compute_type(ctx) click to toggle source
# File lib/ast.rb, line 405
def compute_type(ctx)
        types = {}
        @hash.each { |name, type_expr|
                type_type = type_expr.compute_type ctx
                assert ("annotated expression of record member \"#{name}\" not a type") { type_type.is_a? Types::Type }
                types[name] = type_type.metadata
        }

        Types::Type.new(Types::Record.new types)
end
evaluate(ctx) click to toggle source
# File lib/ast.rb, line 416
def evaluate(ctx)
        types = {}
        @hash.each { |key, node|
                types[key] = node.evaluate ctx
        }
        Types::Record.new types
end