Specific actions to execute on the whole tree of a module

@toimplement

Property definitions

nitc $ Phase :: process_nmodule
	# Specific actions to execute on the whole tree of a module
	# @toimplement
	fun process_nmodule(nmodule: AModule) do end
src/phase.nit:240,2--242,45

nitc $ LiteralPhase :: process_nmodule
	redef fun process_nmodule(nmodule) do nmodule.do_literal(toolcontext)
src/literal.nit:30,2--70

nitc $ ModelizePropertyPhase :: process_nmodule
	redef fun process_nmodule(nmodule)
	do
		for nclassdef in nmodule.n_classdefs do
			if nclassdef.all_defs == null then continue # skip non principal classdef
			toolcontext.modelbuilder.build_properties(nclassdef)
		end
	end
src/modelize/modelize_property.nit:30,2--36,4

nitc $ ModelizeClassPhase :: process_nmodule
	redef fun process_nmodule(nmodule)
	do
		toolcontext.modelbuilder.build_classes(nmodule)
	end
src/modelize/modelize_class.nit:30,2--33,4

nitc $ FFILanguageAssignationPhase :: process_nmodule
	redef fun process_nmodule(nmodule)
	do
		for block in nmodule.n_extern_code_blocks do
			verify_foreign_code_on_node( block )
		end
	end
src/ffi/light_ffi_base.nit:39,2--44,4

nitc $ HeaderDependancyPhase :: process_nmodule
	redef fun process_nmodule(nmodule)
	do
		var mmodule = nmodule.mmodule
		mmodule.compute_header_dependencies(self)
	end
src/ffi/header_dependency.nit:68,2--72,4

nitc $ NoWarningPhase :: process_nmodule
	redef fun process_nmodule(nmodule)
	do
		# Get the mmodule
		var mmodule = nmodule.mmodule
		if mmodule == null then return

		var source = nmodule.location.file

		var nmoduledecl = nmodule.n_moduledecl
		if nmoduledecl == null or nmoduledecl.n_doc == null then
			# Disable `missing-doc` if there is no `module` clause
			# Rationale: the presence of a `module` clause is a good heuristic to
			# discriminate quick and dirty prototypes from nice and clean modules
			if source != null then toolcontext.warning_blacklist[source].add("missing-doc")

		end

		# If no decl block then quit
		if nmoduledecl == null then return

		var modelbuilder = toolcontext.modelbuilder

		# Disable `missing-doc` for `test`
		if source != null and not nmoduledecl.get_annotations("test").is_empty then
			toolcontext.warning_blacklist[source].add("missing-doc")
		end

		# Get all the `no_warning` annotations
		var name = "no_warning"
		var annots = nmoduledecl.get_annotations(name)

		if annots.is_empty then return

		if source == null then
			modelbuilder.warning(annots.first, "file-less-module", "Warning: `{name}` does not currently work on file-less modules.")
			return
		end

		for annot in annots do
			var args = annot.n_args
			if args.is_empty then
				modelbuilder.error(annot, "Syntax Error: `{name}` expects a list of warnings. Use `\"all\"` to disable all warnings.")
				continue
			end
			for arg in args do
				var tag = arg.as_string
				if tag == null then
					modelbuilder.error(arg, "Syntax Error: `{name}` expects String as arguments.")
					continue
				end

				toolcontext.warning_blacklist[source].add(tag)
			end
		end
	end
src/frontend/no_warning.nit:29,2--83,4

nitc $ SimpleMiscAnalysisPhase :: process_nmodule
	redef fun process_nmodule(nmodule) do nmodule.do_simple_misc_analysis(toolcontext)
src/frontend/simple_misc_analysis.nit:33,2--83

nitc $ DivByZeroPhase :: process_nmodule
	# Specific phases just have to implement the `process_nmodule` method.
	redef fun process_nmodule(nmodule)
	do
		# The AST node is not enough, we need also the associated model element
		var mmodule = nmodule.mmodule
		if mmodule == null then return
		# For the specific job we have, the simpler it to launch a visitor on
		# all elements of the AST.
		var visitor = new DivByZeroVisitor(toolcontext, mmodule)
		visitor.enter_visit(nmodule)
	end
src/frontend/div_by_zero.nit:36,2--46,4

nitc $ SerializationPhasePreModel :: process_nmodule
	redef fun process_nmodule(nmodule)
	do
		# Clear the cache of constructors to review before adding to it
		nmodule.inits_to_retype.clear

		# collect all classes
		var auto_serializable_nclassdefs = nmodule.auto_serializable_nclassdefs
		if not auto_serializable_nclassdefs.is_empty then
			generate_deserialization_method(nmodule, auto_serializable_nclassdefs)
		end
	end
src/frontend/serialization_model_phase.nit:160,2--170,4

nitc $ CheckAnnotationPhase :: process_nmodule
	redef fun process_nmodule(nmodule)
	do
		# Get the mmodule
		var mmodule = nmodule.mmodule
		if mmodule == null then return
		self.mmodule = mmodule

		# If no decl block then quit
		var nmoduledecl = nmodule.n_moduledecl
		if nmoduledecl == null then return

		var modelbuilder = toolcontext.modelbuilder

		# Get all the new annotations
		var annots = nmoduledecl.get_annotations("new_annotation")

		var super_mmodules = declared_annotations.lookup_all_modules(mmodule, private_visibility)

		# Add each new annotations in the map
		for annot in annots do
			var name = annot.arg_as_id(modelbuilder)
			if name == null then continue

			for m in super_mmodules do
				if declared_annotations[m].has(name) then
					modelbuilder.warning(annot, "multiple-annotation-declarations", "Warning: an annotation `{name}` is already declared in module `{m}`.")
					break label
				end
			end

			declared_annotations[mmodule].add(name)
			#annot.debug "add {mmodule}: {name}"
		end label
	end
src/frontend/check_annotation.nit:39,2--72,4

nitc $ ParseAnnotationsPhase :: process_nmodule
	# Lookup for `nmodule` annotations
	redef fun process_nmodule(nmodule) do
		var mmodule = nmodule.mmodule
		if mmodule == null then return

		var nmoduledecl = nmodule.n_moduledecl
		if nmoduledecl == null then return

		var nannots = nmoduledecl.n_annotations
		if nannots == null then return

		for nannot in nannots.n_items do
			mmodule.annotations.add nannot.n_atid.n_id.text
		end
	end
src/frontend/parse_annotations.nit:52,2--66,4

nitc $ RegexPhase :: process_nmodule
	redef fun process_nmodule(nmodule)
	do
		var visitor = new RegexVisitor(toolcontext)
		nmodule.accept_regex_visitor visitor
	end
src/frontend/regex_phase.nit:31,2--35,4

nitc $ ActorPhase :: process_nmodule
	redef fun process_nmodule(nmodule) do
		var mmod = nmodule.mmodule
		if mmod == null then return

		if generated_actor_modules.has(mmod.name) then return

		var mclasses_defs = mmod.mclassdefs
		for mclass_def in mclasses_defs do
			var mclass = mclass_def.mclass
			var actor = mclass.actor
			if actor != null then generate_actor_classes(mclass_def, mmod)
		end

	end
src/frontend/actors_generation_phase.nit:206,2--219,4

nitc $ SerializationPhasePostModel :: process_nmodule
	# Fill the deserialization init `from_deserializer` and `Deserializer.deserialize_class_intern`
	redef fun process_nmodule(nmodule)
	do
		for npropdef in nmodule.inits_to_retype do
			var nclassdef = npropdef.parent
			assert nclassdef isa AStdClassdef

			var serialize_by_default = nclassdef.how_serialize
			assert serialize_by_default != null

			var per_attribute = not serialize_by_default
			fill_deserialization_init(nclassdef, npropdef, per_attribute)
		end

		# collect all classes
		var auto_serializable_nclassdefs = nmodule.auto_serializable_nclassdefs
		if not auto_serializable_nclassdefs.is_empty then
			fill_deserialization_method(nmodule, auto_serializable_nclassdefs)
		end
	end
src/frontend/serialization_code_gen_phase.nit:30,2--49,4

nitc $ ExplainAssertPhase :: process_nmodule
	redef fun process_nmodule(nmodule)
	do
		var mmodule = nmodule.mmodule
		if mmodule == null then return

		# Skip if `mmodule` doesn't have access to `String`
		var string_class = toolcontext.modelbuilder.try_get_mclass_by_name(nmodule, mmodule, "String")
		if string_class == null then return

		# Launch a visitor on all elements of the AST
		var visitor = new ExplainAssertVisitor(toolcontext, mmodule, string_class.mclass_type)
		visitor.enter_visit nmodule
	end
src/frontend/explain_assert.nit:50,2--62,4

nitc $ ContractsPhase :: process_nmodule
	redef fun process_nmodule(nmodule)do
		# Check if the contracts are disabled
		if toolcontext.opt_no_contract.value then return
		nmodule.do_contracts(self.toolcontext)
	end
src/contracts.nit:38,2--42,4