Class: Dhall::TypeChecker::If
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::If
- Defined in:
- lib/dhall/typecheck.rb
Defined Under Namespace
Classes: AnnotatedIf
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(expr) ⇒ If
constructor
A new instance of If.
Constructor Details
#initialize(expr) ⇒ If
Returns a new instance of If.
167 168 169 170 171 172 |
# File 'lib/dhall/typecheck.rb', line 167 def initialize(expr) @expr = expr @predicate = TypeChecker.for(expr.predicate) @then = TypeChecker.for(expr.then) @else = TypeChecker.for(expr.else) end |
Instance Method Details
#annotate(context) ⇒ Object
194 195 196 197 198 199 200 201 202 |
# File 'lib/dhall/typecheck.rb', line 194 def annotate(context) AnnotatedIf.new( @expr, @predicate.annotate(context), @then.annotate(context), @else.annotate(context), context: context ).annotation end |