Found annotations names are stored in AnnotatedMEntity::annotations
.
nitc $ ParseAnnotationsPhase :: SELF
Type of this instance, automatically specialized in every classnitc $ ParseAnnotationsPhase :: process_nclassdef
Lookup fornclassdef
annotations
nitc $ ParseAnnotationsPhase :: process_nmodule
Lookup fornmodule
annotations
nitc $ ParseAnnotationsPhase :: process_npropdef
Lookup fornpropdef
annotations
nitc :: Phase :: _in_hierarchy
The dependence relation of the phase with the other phasesnitc :: Phase :: _toolcontext
The toolcontext instance attached to the phasecore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
nitc :: Phase :: defaultinit
nitc :: Phase :: in_hierarchy
The dependence relation of the phase with the other phasesnitc :: Phase :: in_hierarchy=
The dependence relation of the phase with the other phasescore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: Phase :: process_annotated_node
Specific actions to execute on annotated nodesnitc :: Phase :: process_mainmodule
Specific action to execute on the whole program.nitc :: Phase :: process_nclassdef
Specific actions to execute on the tree of a class definitionnitc :: Phase :: process_nmodule
Specific actions to execute on the whole tree of a modulenitc :: Phase :: process_nmodule_after
Specific actions to execute on the whole tree of a modulenitc :: Phase :: process_npropdef
Specific actions to execute on the tree of a propertynitc :: Phase :: toolcontext
The toolcontext instance attached to the phasenitc :: Phase :: toolcontext=
The toolcontext instance attached to the phase
# 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