Class: Dhallish::Ast::RecordTypeNode
- Inherits:
-
Object
- Object
- Dhallish::Ast::RecordTypeNode
- Defined in:
- lib/ast.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
- #compute_type(ctx) ⇒ Object
- #evaluate(ctx) ⇒ Object
-
#initialize(hash) ⇒ RecordTypeNode
constructor
A new instance of RecordTypeNode.
Constructor Details
#initialize(hash) ⇒ RecordTypeNode
Returns a new instance of RecordTypeNode.
401 402 403 |
# File 'lib/ast.rb', line 401 def initialize(hash) @hash = hash end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
400 401 402 |
# File 'lib/ast.rb', line 400 def hash @hash end |
Instance Method Details
#compute_type(ctx) ⇒ Object
405 406 407 408 409 410 411 412 413 414 |
# 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. } Types::Type.new(Types::Record.new types) end |