Specific phases should implements one of the process_*
method
nitc :: Phase :: _in_hierarchy
The dependence relation of the phase with the other phasesnitc :: Phase :: _toolcontext
The toolcontext instance attached to the phasenitc :: 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 phasesnitc :: 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 phasenitc :: 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.
nitc :: Phase :: defaultinit
core :: Object :: 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 phasenitc :: ActorPhase
nitc :: DefaultPhase
Empty phase that delegatesprocess_mainmodule
to the global do_work
.
nitc :: ExternClassesTypingPhaseAst
Assigns theftype
to class definitions, work on the AST only
nitc :: FFILanguageAssignationPhase
Phase that assign aFFILanguage
to all AExternCodeBlock
nitc :: InheritanceMetricsPhase
Extract metrics about inheritance from model.nitc :: LiteralPhase
nitc :: NitwebPhase
Phase that builds the model and wait for http request to serve pages.pkgconfig
annotation on the module declaration only
nitc :: RegexPhase
nitc :: RestfulPhase
nitc :: ScopePhase
nitc :: TypingPhase
nitc :: VerifyNitniCallbacksPhase
# Abstraction of steps in the analysis/processing of Nit programs
# Specific phases should implements one of the `process_*` method
abstract class Phase
# The toolcontext instance attached to the phase
var toolcontext: ToolContext
# The dependence relation of the phase with the other phases
var in_hierarchy: POSetElement[Phase] is noinit
# The explicit dependences, used to initialize `in_importation`
var depends: nullable Collection[Phase]
# Initialize and register a phase to the toolcontext
init
do
in_hierarchy = toolcontext.phases.add_node(self)
var depends = self.depends
if depends != null then
for d in depends do
toolcontext.phases.add_edge(self, d)
end
end
end
# By default, the name is the lowercased prefix of the classname
redef fun to_s do return class_name.strip_extension("Phase").to_snake_case
# Is the phase globally disabled?
# A disabled phase is not called automatically called by `ToolContext::run_phases` and cie.
#
# Warning: disabling a phase may cause subsequent phases to work in a degraded way or to fail.
var disabled = false is writable
# Specific actions to execute on the whole tree of a module
# @toimplement
fun process_nmodule(nmodule: AModule) do end
# Specific actions to execute on the tree of a class definition
# Note that the order of the visit is the one of the file
# @toimplement
fun process_nclassdef(nclassdef: AClassdef) do end
# Specific actions to execute on the tree of a property
# Note that the order of the visit is the one of the file
# @toimplement
fun process_npropdef(npropdef: APropdef) do end
# Specific actions to execute on annotated nodes
# Note that the order of the visit is the one of the file
# @toimplement
fun process_annotated_node(node: ANode, nat: AAnnotation) do end
# Specific actions to execute on the whole tree of a module
# Called at the end of a phase on a module
# Last called hook
# @toimplement
fun process_nmodule_after(nmodule: AModule) do end
end
src/phase.nit:207,1--264,3
redef class Phase
# Specific action to execute on the whole program.
# Called by the `ToolContext::run_global_phases`.
#
# `mainmodule` is the main module of the program.
# It could be an implicit module (called like the first given_mmodules).
#
# `given_modules` is the list of explicitely requested modules.
# from the command-line for instance.
#
# REQUIRE: `not given_modules.is_empty`
# REQUIRE: `(given_modules.length == 1) == (mainmodule == given_modules.first)`
#
# @toimplement
fun process_mainmodule(mainmodule: MModule, given_mmodules: SequenceRead[MModule]) do end
end
src/modelbuilder.nit:73,1--88,3