Module: DhallishGrammar::FunctionTypeExpression2

Defined in:
lib/DhallishGrammar.rb

Instance Method Summary collapse

Instance Method Details

#to_nodeObject



3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
# File 'lib/DhallishGrammar.rb', line 3336

def to_node()
	if tail.elements.size == 0
		arg_type.to_node()
	else
		tree = nil
		tail.elements.reverse.each { |node|
			if tree.nil?
				tree = node.res_type.to_node()
			else
				tree = Dhallish::Ast::FunctionType.new node.res_type.to_node(), tree
			end
		}
		Dhallish::Ast::FunctionType.new arg_type.to_node(), tree
	end
end