-redef class AAtArg
- # Get `self` as a `String`.
- # Return null if not a string.
- fun as_string: nullable String
+redef class ModelBuilder
+ # Collect all annotations by `name` assocated to `mmodule` and its imported modules.
+ # Note that visibility is not considered.
+ fun collect_annotations_on_modules(name: String, mmodule: MModule): Array[AAnnotation]
+ do
+ var annotations = new Array[AAnnotation]
+ for mmod in mmodule.in_importation.greaters do
+ var amod = mmodule2node(mmod)
+ if amod == null then continue
+ var module_decl = amod.n_moduledecl
+ if module_decl == null then continue
+ var aas = module_decl.get_annotations(name)
+ annotations.add_all aas
+ end
+ return annotations
+ end
+
+ # Return the single annotation `name` locally assocated to `mmodule`, if any.
+ # Obviously, if there is no ast associated to `mmodule`, then nothing is returned.
+ fun get_mmodule_annotation(name: String, mmodule: MModule): nullable AAnnotation