contrib/jwrapper: rename the `types` module to `model`
[nit.git] / src / phase.nit
index 57b8b53..5729313 100644 (file)
@@ -21,7 +21,7 @@ import poset
 
 redef class ToolContext
        # The various registered phases to performs
-       # The order in the poset is the dependance of phases
+       # The order in the poset is the dependence of phases
        #
        # While you can directly modify the poset (nodes and edges),
        # it is often simpler to use the constructor in `Phase`
@@ -64,6 +64,7 @@ redef class ToolContext
                end
        end
 
+       # The list of registered phases in the application order.
        fun phases_list: Sequence[Phase]
        do
                var phases = self.phases.to_a
@@ -136,7 +137,9 @@ redef class ToolContext
                errors_info
        end
 
-       fun phase_process_npropdef(phase: Phase, npropdef: APropdef)
+       # Process the given `phase` on the `npropdef`
+       # Called by `run_phases`
+       protected fun phase_process_npropdef(phase: Phase, npropdef: APropdef)
        do
                phase.process_npropdef(npropdef)
        end
@@ -163,13 +166,16 @@ abstract class Phase
        var toolcontext: ToolContext
 
        # The dependence relation of the phase with the other phases
-       var in_hierarchy: POSetElement[Phase]
+       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(toolcontext: ToolContext, depends: nullable Collection[Phase])
+       init
        do
-               self.toolcontext = toolcontext
                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)