Module: DhallishGrammar::RecordLiteral4

Defined in:
lib/DhallishGrammar.rb

Instance Method Summary collapse

Instance Method Details

#to_nodeObject



1719
1720
1721
1722
1723
1724
1725
1726
1727
# File 'lib/DhallishGrammar.rb', line 1719

def to_node()
	data = { fstkey.text_value => fstexp.to_node() }
	tail.elements.each { |node|
		key = node.key.text_value
		assert("no key should apeare multiple times in a record: `#{key}`") { !data.key?(key) }
		data[key] = node.exp.to_node()
	}
	Dhallish::Ast::RecordNode.new data
end