Class: Dhall::TypeChecker::If

Inherits:
Object
  • Object
show all
Defined in:
lib/dhall/typecheck.rb

Defined Under Namespace

Classes: AnnotatedIf

Instance Method Summary collapse

Constructor Details

#initialize(expr) ⇒ If

Returns a new instance of If.



169
170
171
172
173
174
# File 'lib/dhall/typecheck.rb', line 169

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



196
197
198
199
200
201
202
203
204
# File 'lib/dhall/typecheck.rb', line 196

def annotate(context)
	AnnotatedIf.new(
		@expr,
		@predicate.annotate(context),
		@then.annotate(context),
		@else.annotate(context),
		context: context
	).annotation
end