Class: Dhall::TypeChecker::RecordProjectionByExpression
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::RecordProjectionByExpression
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(projection) ⇒ RecordProjectionByExpression
constructor
A new instance of RecordProjectionByExpression.
Constructor Details
#initialize(projection) ⇒ RecordProjectionByExpression
Returns a new instance of RecordProjectionByExpression.
661 662 663 664 665 666 667 668 |
# File 'lib/dhall/typecheck.rb', line 661 def initialize(projection) @selector = projection.selector.normalize @project_by_expression = projection @project_by_keys = Dhall::RecordProjection.for( @project_by_expression.record, @selector.keys ) end |
Instance Method Details
#annotate(context) ⇒ Object
670 671 672 673 674 675 676 677 678 679 680 681 682 |
# File 'lib/dhall/typecheck.rb', line 670 def annotate(context) TypeChecker.assert @selector, Dhall::RecordType, "RecordProjectionByExpression on #{@selector.class}" TypeChecker.assert_type @project_by_keys, @selector, "Type doesn't match #{@selector}", context: context Dhall::TypeAnnotation.new( value: @project_by_expression, type: @selector ) end |