nitc :: Phase :: process_nmodule_after
Called at the end of a phase on a module Last called hook @toimplement
# 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
src/phase.nit:259,2--263,51
redef fun process_nmodule_after(nmodule) do
var first_mmodule = nmodule.mmodule
if first_mmodule == null then return
# Be careful not to generate useless submodules !
if not first_mmodule.generate_actor_submodule then return
# Name of the support module
var module_name
# Path to the support module
module_name = "actors_{first_mmodule.name}"
# We assume a module using actors has a `filepath` not null
var mmodule_path = first_mmodule.filepath.as(not null).dirname
var module_path = "{mmodule_path}/{module_name}.nit"
var nit_module = new NitModule(module_name)
nit_module.annotations.add "no_warning(\"missing-doc\")"
nit_module.header = """
# This file is generated by nitactors (threaded version)
# Do not modify, instead use the generated services.
"""
# for mmod in mmodules do nit_module.imports.add mmod.name
nit_module.imports.add first_mmodule.name
generated_actor_modules.add(module_name)
var idx = generated_actor_modules.index_of(module_name)
for i in [0..idx[ do nit_module.imports.add(generated_actor_modules[i])
nit_module.content.add "####################### Redef classes #########################"
for c in redef_classes do nit_module.content.add( c + "\n\n" )
nit_module.content.add "####################### Actor classes #########################"
for c in actors do nit_module.content.add( c + "\n\n" )
nit_module.content.add "####################### Messages classes ######################"
for c in messages do nit_module.content.add( c + "\n\n" )
nit_module.content.add "####################### Proxy classes #########################"
for c in proxys do nit_module.content.add( c + "\n\n" )
# Write support module
nit_module.write_to_file module_path
actors.clear
messages.clear
proxys.clear
redef_classes.clear
toolcontext.modelbuilder.inject_module_subimportation(first_mmodule, module_path)
end
src/frontend/actors_generation_phase.nit:231,2--285,4