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.



188
189
190
191
192
193
# File 'lib/dhall/typecheck.rb', line 188

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



215
216
217
218
219
220
221
222
223
# File 'lib/dhall/typecheck.rb', line 215

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