# Parse annotations from modules, classdefs and propdefs
#
# Found annotations names are stored in `AnnotatedMEntity::annotations`.
private class ParseAnnotationsPhase
super Phase
# Lookup for `nmodule` annotations
redef fun process_nmodule(nmodule) do
var mmodule = nmodule.mmodule
if mmodule == null then return
var nmoduledecl = nmodule.n_moduledecl
if nmoduledecl == null then return
var nannots = nmoduledecl.n_annotations
if nannots == null then return
for nannot in nannots.n_items do
mmodule.annotations.add nannot.n_atid.n_id.text
end
end
# Lookup for `nclassdef` annotations
redef fun process_nclassdef(nclassdef) do
var mclassdef = nclassdef.mclassdef
if mclassdef == null then return
for npropdef in nclassdef.n_propdefs do
if not npropdef isa AAnnotPropdef then continue
mclassdef.annotations.add npropdef.n_atid.n_id.text
end
end
# Lookup for `npropdef` annotations
redef fun process_npropdef(npropdef) do
var mpropdef = npropdef.mpropdef
if mpropdef == null then return
var nannots = npropdef.n_annotations
if nannots == null then return
for nannot in nannots.n_items do
mpropdef.annotations.add nannot.n_atid.n_id.text
end
end
end
src/frontend/parse_annotations.nit:46,1--91,3