Try to get its single annotation with a given name

If there is no such an annotation, null is returned. If there is more than one annotation, a error message is printed and the first annotation is returned

Property definitions

nitc :: annotation $ Prod :: get_single_annotation
	# Try to get its single annotation with a given name
	# If there is no such an annotation, null is returned.
	# If there is more than one annotation, a error message is printed and the first annotation is returned
	fun get_single_annotation(name: String, modelbuilder: ModelBuilder): nullable AAnnotation
	do
		var res = get_annotations(name)
		if res.is_empty then return null
		if res.length > 1 then
			modelbuilder.error(res[1], "Syntax Error: multiple `{name}`. A previous one is defined line {res[0].location.line_start}.")
		end
		return res.first
	end
src/annotation.nit:25,2--36,4