9dc649390e6e288e2497d3bfc61016c988d39d84
[nit.git] / src / frontend.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Collect and orchestration of main frontend phases
16 module frontend
17
18 import phase
19 import simple_misc_analysis
20 import literal
21 import scope
22 import flow
23 import local_var_init
24 import typing
25 import auto_super_init
26 import div_by_zero
27
28 redef class ToolContext
29 # FIXME: there is conflict in linex in nitc, so use this trick to force invocation
30 private var dummy: Bool = do_dummy
31 fun do_dummy: Bool
32 do
33 # Force easy warnings aftrm modelbuilder
34 phases.add_edge(simple_misc_analysis_phase, modelize_property_phase)
35 # Force easy warnings before intraproc-errors
36 phases.add_edge(scope_phase, simple_misc_analysis_phase)
37 return true
38 end
39
40 fun run_global_phases(mainmodule: MModule)
41 do
42 for phase in phases_list do
43 phase.process_mainmodule(mainmodule)
44 end
45 end
46 end
47
48 redef class Phase
49 # Specific action to execute on the whole program
50 # Called by the `ToolContext::run_global_phases`
51 # @toimplement
52 fun process_mainmodule(mainmodule: MModule) do end
53 end
54