X-Git-Url: http://nitlanguage.org diff --git a/src/phase.nit b/src/phase.nit index f927dc1..682d23e 100644 --- a/src/phase.nit +++ b/src/phase.nit @@ -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` @@ -69,8 +69,8 @@ redef class ToolContext if opt_sloppy.value then semantize_is_lazy = true end - fun phases_list: Sequence[Phase] - do + # The list of registered phases in the application order. + var phases_list: Sequence[Phase] is lazy do var phases = self.phases.to_a self.phases.sort(phases) return phases @@ -110,13 +110,11 @@ redef class ToolContext for phase in phases do if phase.disabled then continue - self.info(" phase: {phase}", 3) assert phase.toolcontext == self var errcount = self.error_count phase.process_nmodule(nmodule) if errcount != self.error_count then self.check_errors - break end errcount = self.error_count for nclassdef in nmodule.n_classdefs do @@ -129,14 +127,15 @@ redef class ToolContext end if errcount != self.error_count then self.check_errors - break end for na in vannot.annotations do - phase.process_annotated_node(na.parent.parent.as(not null), na) + var p = na.parent + if p isa AAnnotations then p = p.parent + assert p != null + phase.process_annotated_node(p, na) end if errcount != self.error_count then self.check_errors - break end end self.check_errors @@ -145,10 +144,12 @@ redef class ToolContext var time1 = get_time self.info("*** END SEMANTIC ANALYSIS: {time1-time0} ***", 2) - errors_info + self.check_errors 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 @@ -218,7 +219,7 @@ abstract class Phase end # By default, the name is the lowercased prefix of the classname - redef fun to_s do return class_name.strip_extension("Phase").to_lower + 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.