mmodule
and its super modules. Will recursively searchin imported module to find the "latest" declaration and detects priority conflicts.
# Get an annotation by name from `mmodule` and its super modules. Will recursively search
# in imported module to find the "latest" declaration and detects priority conflicts.
fun lookup_annotation_on_modules(name: String, mmodule: MModule): nullable AAnnotation
do
var data = collect_annotations_data(name, mmodule)
var annotations = data.lookup_values(mmodule, none_visibility)
if annotations.is_empty then return null
if annotations.length > 1 then
var locs = new Array[Location]
for annot in annotations do locs.add(annot.location)
toolcontext.error(mmodule.location,
"Error: priority conflict on annotation `{name}`, it has been defined in: {locs.join(", ")}.")
end
return annotations.first
end
src/annotation.nit:133,2--148,4