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.
163 164 165 166 167 168 |
# File 'lib/dhall/typecheck.rb', line 163 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
190 191 192 193 194 195 196 197 198 |
# File 'lib/dhall/typecheck.rb', line 190 def annotate(context) AnnotatedIf.new( @expr, @predicate.annotate(context), @then.annotate(context), @else.annotate(context), context: context ).annotation end |