The main node of a Nit source-file

Introduced properties

private var _auto_serializable_nclassdefs: Array[AStdClassdef]

nitc :: AModule :: _auto_serializable_nclassdefs

AStdClassdef marked as serializable, itself or one of theur attribute
private var _build_classes_is_done: Bool

nitc :: AModule :: _build_classes_is_done

Flag that indicate if the class building is already completed
private var _is_importation_done: Bool

nitc :: AModule :: _is_importation_done

Flag that indicate if the importation is already completed
private var _mclass2nclassdef: Map[MClass, AClassdef]

nitc :: AModule :: _mclass2nclassdef

What is the AClassdef associated to a MClass?
private var _mmodule: nullable MModule

nitc :: AModule :: _mmodule

The associated MModule once build by a ModelBuilder
private var _n_classdefs: ANodes[AClassdef]

nitc :: AModule :: _n_classdefs

List of class definition (including top-level methods and the main)
private var _n_extern_code_blocks: ANodes[AExternCodeBlock]

nitc :: AModule :: _n_extern_code_blocks

List of extern blocks
private var _n_imports: ANodes[AImport]

nitc :: AModule :: _n_imports

List of importation clauses
private var _n_moduledecl: nullable AModuledecl

nitc :: AModule :: _n_moduledecl

The declaration part of the module
private fun auto_serializable_nclassdefs: Array[AStdClassdef]

nitc :: AModule :: auto_serializable_nclassdefs

AStdClassdef marked as serializable, itself or one of theur attribute
private fun auto_serializable_nclassdefs=(auto_serializable_nclassdefs: Array[AStdClassdef])

nitc :: AModule :: auto_serializable_nclassdefs=

AStdClassdef marked as serializable, itself or one of theur attribute
fun build_classes_is_done: Bool

nitc :: AModule :: build_classes_is_done

Flag that indicate if the class building is already completed
protected fun build_classes_is_done=(build_classes_is_done: Bool)

nitc :: AModule :: build_classes_is_done=

Flag that indicate if the class building is already completed
private fun collect_mtypes: Set[MType]

nitc :: AModule :: collect_mtypes

Collect all MType use in extern methods within this module
fun compile_foreign_lib(v: NaiveInterpreter): Bool

nitc :: AModule :: compile_foreign_lib

Compile user FFI code and a standardized API into a .so file
private fun compile_foreign_lib_api(compdir: String): CCompilationUnit

nitc :: AModule :: compile_foreign_lib_api

Compile the standard API of the .so file
fun do_contracts(toolcontext: ToolContext)

nitc :: AModule :: do_contracts

Compile all contracts
fun do_literal(toolcontext: ToolContext)

nitc :: AModule :: do_literal

Visit the module to compute the real value of the literal-related node of the AST.
fun do_simple_misc_analysis(toolcontext: ToolContext)

nitc :: AModule :: do_simple_misc_analysis

Visit the module to detect easy warnings that does not need the metamodel or the importation
fun ensure_compile_ffi_wrapper

nitc :: AModule :: ensure_compile_ffi_wrapper

Ensures all of the general foreign code of the module has been analyzed.
private fun foreign_code_lib(v: NaiveInterpreter): nullable ForeignCodeLib

nitc :: AModule :: foreign_code_lib

Handle to the external library with FFI code
private fun foreign_code_lib_cache=(foreign_code_lib_cache: nullable ForeignCodeLib)

nitc :: AModule :: foreign_code_lib_cache=

init init_amodule(n_moduledecl: nullable AModuledecl, n_imports: Collection[Object], n_extern_code_blocks: Collection[Object], n_classdefs: Collection[Object])

nitc :: AModule :: init_amodule

private fun inits_to_retype=(inits_to_retype: Array[AMethPropdef])

nitc :: AModule :: inits_to_retype=

fun is_importation_done: Bool

nitc :: AModule :: is_importation_done

Flag that indicate if the importation is already completed
protected fun is_importation_done=(is_importation_done: Bool)

nitc :: AModule :: is_importation_done=

Flag that indicate if the importation is already completed
fun mclass2nclassdef: Map[MClass, AClassdef]

nitc :: AModule :: mclass2nclassdef

What is the AClassdef associated to a MClass?
protected fun mclass2nclassdef=(mclass2nclassdef: Map[MClass, AClassdef])

nitc :: AModule :: mclass2nclassdef=

What is the AClassdef associated to a MClass?
fun mmodule: nullable MModule

nitc :: AModule :: mmodule

The associated MModule once build by a ModelBuilder
protected fun mmodule=(mmodule: nullable MModule)

nitc :: AModule :: mmodule=

The associated MModule once build by a ModelBuilder
fun n_classdefs: ANodes[AClassdef]

nitc :: AModule :: n_classdefs

List of class definition (including top-level methods and the main)
protected fun n_classdefs=(n_classdefs: ANodes[AClassdef])

nitc :: AModule :: n_classdefs=

List of class definition (including top-level methods and the main)
protected fun n_extern_code_blocks=(n_extern_code_blocks: ANodes[AExternCodeBlock])

nitc :: AModule :: n_extern_code_blocks=

List of extern blocks
fun n_imports: ANodes[AImport]

nitc :: AModule :: n_imports

List of importation clauses
protected fun n_imports=(n_imports: ANodes[AImport])

nitc :: AModule :: n_imports=

List of importation clauses
fun n_moduledecl: nullable AModuledecl

nitc :: AModule :: n_moduledecl

The declaration part of the module
fun n_moduledecl=(n_moduledecl: nullable AModuledecl)

nitc :: AModule :: n_moduledecl=

The declaration part of the module

Redefined properties

redef type SELF: AModule

nitc $ AModule :: SELF

Type of this instance, automatically specialized in every class
redef fun accept_pretty_printer(v: PrettyPrinterVisitor)

nitc :: pretty $ AModule :: accept_pretty_printer

Start visit of self using a PrettyPrinterVisitor
redef fun is_inlinable: Bool

nitc :: pretty $ AModule :: is_inlinable

Is self printable in one line?
redef fun is_serialize: Bool

nitc :: serialization_model_phase $ AModule :: is_serialize

Is this node annotated to be made serializable?
redef fun n_moduledecl=(node: nullable AModuledecl)

nitc :: parser_prod $ AModule :: n_moduledecl=

The declaration part of the module
redef fun replace_child(old_child: ANode, new_child: nullable ANode)

nitc :: parser_prod $ AModule :: replace_child

Replace a child with an other node in the AST
redef fun start_token: nullable Token

nitc :: pretty $ AModule :: start_token

Skip doc if any.
redef fun visit_all(v: Visitor)

nitc :: parser_prod $ AModule :: visit_all

Visit all nodes in order.

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _auto_serializable_nclassdefs: Array[AStdClassdef]

nitc :: AModule :: _auto_serializable_nclassdefs

AStdClassdef marked as serializable, itself or one of theur attribute
private var _build_classes_is_done: Bool

nitc :: AModule :: _build_classes_is_done

Flag that indicate if the class building is already completed
private var _first_location: nullable Location

nitc :: Prod :: _first_location

Location on the first token after the start of a production
private var _first_token: nullable Token

nitc :: Prod :: _first_token

The first token of the production in the AST
private var _force_block: Bool

nitc :: ANode :: _force_block

Force self to be rendered as a block.
private var _force_inline: Bool

nitc :: ANode :: _force_inline

Force self to be rendered as a line.
private var _is_broken: Bool

nitc :: ANode :: _is_broken

The indication that the node did not pass some semantic verifications.
private var _is_importation_done: Bool

nitc :: AModule :: _is_importation_done

Flag that indicate if the importation is already completed
private var _last_token: nullable Token

nitc :: Prod :: _last_token

The last token of the production in the AST
private var _location: Location

nitc :: ANode :: _location

Location is set during AST building. Once built, location can not be null.
private var _mclass2nclassdef: Map[MClass, AClassdef]

nitc :: AModule :: _mclass2nclassdef

What is the AClassdef associated to a MClass?
private var _mmodule: nullable MModule

nitc :: AModule :: _mmodule

The associated MModule once build by a ModelBuilder
private var _n_annotations: nullable AAnnotations

nitc :: Prod :: _n_annotations

All the annotations attached directly to the node
private var _n_classdefs: ANodes[AClassdef]

nitc :: AModule :: _n_classdefs

List of class definition (including top-level methods and the main)
private var _n_extern_code_blocks: ANodes[AExternCodeBlock]

nitc :: AModule :: _n_extern_code_blocks

List of extern blocks
private var _n_imports: ANodes[AImport]

nitc :: AModule :: _n_imports

List of importation clauses
private var _n_moduledecl: nullable AModuledecl

nitc :: AModule :: _n_moduledecl

The declaration part of the module
private var _parent: nullable ANode

nitc :: ANode :: _parent

Parent of the node in the AST
fun accept_forward_analysis(v: ForwardAnalysis)

nitc :: ANode :: accept_forward_analysis

Apply the forward analysis v to self.
private abstract fun accept_pretty_printer(v: PrettyPrinterVisitor)

nitc :: ANode :: accept_pretty_printer

Start visit of self using a PrettyPrinterVisitor
fun accept_reaching_defs(v: ReachingDefsAnalysis)

nitc :: ANode :: accept_reaching_defs

Apply a ReachingDefsAnalysis to self.
private fun auto_serializable_nclassdefs: Array[AStdClassdef]

nitc :: AModule :: auto_serializable_nclassdefs

AStdClassdef marked as serializable, itself or one of theur attribute
private fun auto_serializable_nclassdefs=(auto_serializable_nclassdefs: Array[AStdClassdef])

nitc :: AModule :: auto_serializable_nclassdefs=

AStdClassdef marked as serializable, itself or one of theur attribute
private fun bad_expr_message(child: AExpr): nullable String

nitc :: ANode :: bad_expr_message

An additional information message to explain the role of a child expression.
fun build_classes_is_done: Bool

nitc :: AModule :: build_classes_is_done

Flag that indicate if the class building is already completed
protected fun build_classes_is_done=(build_classes_is_done: Bool)

nitc :: AModule :: build_classes_is_done=

Flag that indicate if the class building is already completed
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
abstract fun clone: SELF

core :: Cloneable :: clone

Duplicate self
fun collect_annotations_by_name(name: String): Array[AAnnotation]

nitc :: ANode :: collect_annotations_by_name

Do a deep search and return an array of node that are annotated
private fun collect_comments: Array[TComment]

nitc :: Prod :: collect_comments

Collect all TComment contained in the production
private abstract fun collect_length: Int

nitc :: ANode :: collect_length

Collect the length (in Char) of the node.
private fun collect_mtypes: Set[MType]

nitc :: AModule :: collect_mtypes

Collect all MType use in extern methods within this module
fun collect_text: String

nitc :: Prod :: collect_text

Join the text of all visited tokens
fun collect_tokens_by_text(text: String): Array[Token]

nitc :: ANode :: collect_tokens_by_text

Do a deep search and return an array of tokens that match a given text
fun common_parent(other: ANode): nullable ANode

nitc :: ANode :: common_parent

The most specific common parent between self and other
fun compile_foreign_lib(v: NaiveInterpreter): Bool

nitc :: AModule :: compile_foreign_lib

Compile user FFI code and a standardized API into a .so file
private fun compile_foreign_lib_api(compdir: String): CCompilationUnit

nitc :: AModule :: compile_foreign_lib_api

Compile the standard API of the .so file
fun debug(message: String)

nitc :: ANode :: debug

Display a message for the colored location of the node
protected fun decorate_tag(v: HtmlightVisitor, res: HTMLTag, token: Token): nullable HInfoBox

nitc :: ANode :: decorate_tag

Add aditionnal information on a child-token and return an additionnal HInfoBox on it
fun depth: Int

nitc :: ANode :: depth

Number of nodes between self and the root of the AST
fun detach

nitc :: ANode :: detach

Detach a node from its parent
private fun do_cloneable(v: CloneVisitor)

nitc :: ANode :: do_cloneable

fun do_contracts(toolcontext: ToolContext)

nitc :: AModule :: do_contracts

Compile all contracts
fun do_literal(toolcontext: ToolContext)

nitc :: AModule :: do_literal

Visit the module to compute the real value of the literal-related node of the AST.
fun do_simple_misc_analysis(toolcontext: ToolContext)

nitc :: AModule :: do_simple_misc_analysis

Visit the module to detect easy warnings that does not need the metamodel or the importation
fun dump_info(v: ASTDump): String

nitc :: ANode :: dump_info

Information to display on a node
fun dump_tree(display_structural: nullable Bool, display_line: nullable Bool)

nitc :: ANode :: dump_tree

Write the subtree on stdout.
fun ensure_compile_ffi_wrapper

nitc :: AModule :: ensure_compile_ffi_wrapper

Ensures all of the general foreign code of the module has been analyzed.
fun fatal(v: NaiveInterpreter, message: String)

nitc :: ANode :: fatal

Aborts the program with a message
fun first_location: nullable Location

nitc :: Prod :: first_location

Location on the first token after the start of a production
protected fun first_location=(first_location: nullable Location)

nitc :: Prod :: first_location=

Location on the first token after the start of a production
fun first_token: nullable Token

nitc :: Prod :: first_token

The first token of the production in the AST
protected fun first_token=(first_token: nullable Token)

nitc :: Prod :: first_token=

The first token of the production in the AST
private fun force_block: Bool

nitc :: ANode :: force_block

Force self to be rendered as a block.
private fun force_block=(force_block: Bool)

nitc :: ANode :: force_block=

Force self to be rendered as a block.
private fun force_inline: Bool

nitc :: ANode :: force_inline

Force self to be rendered as a line.
private fun force_inline=(force_inline: Bool)

nitc :: ANode :: force_inline=

Force self to be rendered as a line.
private fun foreign_code_lib(v: NaiveInterpreter): nullable ForeignCodeLib

nitc :: AModule :: foreign_code_lib

Handle to the external library with FFI code
private fun foreign_code_lib_cache=(foreign_code_lib_cache: nullable ForeignCodeLib)

nitc :: AModule :: foreign_code_lib_cache=

fun get_annotations(name: String): Array[AAnnotation]

nitc :: Prod :: get_annotations

Return all its annotations of a given name in the order of their declaration
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun get_single_annotation(name: String, modelbuilder: ModelBuilder): nullable AAnnotation

nitc :: Prod :: get_single_annotation

Try to get its single annotation with a given name
fun hash: Int

core :: Object :: hash

The hash code of the object.
fun hot_location: Location

nitc :: ANode :: hot_location

The location of the important part of the node (identifier or whatever)
fun infobox(v: HtmlightVisitor): nullable HInfoBox

nitc :: ANode :: infobox

Return a optional infobox
init init

core :: Object :: init

init init_amodule(n_moduledecl: nullable AModuledecl, n_imports: Collection[Object], n_extern_code_blocks: Collection[Object], n_classdefs: Collection[Object])

nitc :: AModule :: init_amodule

private fun inits_to_retype=(inits_to_retype: Array[AMethPropdef])

nitc :: AModule :: inits_to_retype=

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_block: Bool

nitc :: Prod :: is_block

Is the production contained in full block of line?
fun is_broken: Bool

nitc :: ANode :: is_broken

The indication that the node did not pass some semantic verifications.
fun is_broken=(is_broken: Bool)

nitc :: ANode :: is_broken=

The indication that the node did not pass some semantic verifications.
fun is_importation_done: Bool

nitc :: AModule :: is_importation_done

Flag that indicate if the importation is already completed
protected fun is_importation_done=(is_importation_done: Bool)

nitc :: AModule :: is_importation_done=

Flag that indicate if the importation is already completed
private fun is_inlinable: Bool

nitc :: ANode :: is_inlinable

Is self printable in one line?
private fun is_noserialize: Bool

nitc :: ANode :: is_noserialize

Is this node annotated to not be made serializable?
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
private fun is_serialize: Bool

nitc :: ANode :: is_serialize

Is this node annotated to be made serializable?
fun is_span: Bool

nitc :: Prod :: is_span

Is the production a part of a single line (without being a block)
fun is_structural: Bool

nitc :: ANode :: is_structural

Is self a token or a pure-structural production like AQId?
fun last_token: nullable Token

nitc :: Prod :: last_token

The last token of the production in the AST
protected fun last_token=(last_token: nullable Token)

nitc :: Prod :: last_token=

The last token of the production in the AST
fun location: Location

nitc :: ANode :: location

Location is set during AST building. Once built, location can not be null.
fun location=(location: Location)

nitc :: ANode :: location=

Location is set during AST building. Once built, location can not be null.
protected fun make_tag(v: HtmlightVisitor): nullable HTMLTag

nitc :: ANode :: make_tag

Optionally creates a tag that encapsulate the AST element on HTML rendering
fun mclass2nclassdef: Map[MClass, AClassdef]

nitc :: AModule :: mclass2nclassdef

What is the AClassdef associated to a MClass?
protected fun mclass2nclassdef=(mclass2nclassdef: Map[MClass, AClassdef])

nitc :: AModule :: mclass2nclassdef=

What is the AClassdef associated to a MClass?
fun mmodule: nullable MModule

nitc :: AModule :: mmodule

The associated MModule once build by a ModelBuilder
protected fun mmodule=(mmodule: nullable MModule)

nitc :: AModule :: mmodule=

The associated MModule once build by a ModelBuilder
private fun must_be_block: Bool

nitc :: ANode :: must_be_block

Does self have to be rendered as a block?
private fun must_be_inline: Bool

nitc :: ANode :: must_be_inline

Does self have be rendered as a line?
fun n_annotations: nullable AAnnotations

nitc :: Prod :: n_annotations

All the annotations attached directly to the node
fun n_annotations=(n_annotations: nullable AAnnotations)

nitc :: Prod :: n_annotations=

All the annotations attached directly to the node
fun n_classdefs: ANodes[AClassdef]

nitc :: AModule :: n_classdefs

List of class definition (including top-level methods and the main)
protected fun n_classdefs=(n_classdefs: ANodes[AClassdef])

nitc :: AModule :: n_classdefs=

List of class definition (including top-level methods and the main)
protected fun n_extern_code_blocks=(n_extern_code_blocks: ANodes[AExternCodeBlock])

nitc :: AModule :: n_extern_code_blocks=

List of extern blocks
fun n_imports: ANodes[AImport]

nitc :: AModule :: n_imports

List of importation clauses
protected fun n_imports=(n_imports: ANodes[AImport])

nitc :: AModule :: n_imports=

List of importation clauses
fun n_moduledecl: nullable AModuledecl

nitc :: AModule :: n_moduledecl

The declaration part of the module
fun n_moduledecl=(n_moduledecl: nullable AModuledecl)

nitc :: AModule :: n_moduledecl=

The declaration part of the module
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun parent: nullable ANode

nitc :: ANode :: parent

Parent of the node in the AST
protected fun parent=(parent: nullable ANode)

nitc :: ANode :: parent=

Parent of the node in the AST
fun parentize_tokens

nitc :: ANode :: parentize_tokens

Visit the AST and computes advanced AST attributes on Tokens and Prod
private abstract fun replace_child(old_child: ANode, new_child: nullable ANode)

nitc :: ANode :: replace_child

Replace a child with an other node in the AST
fun replace_clone

nitc :: ANode :: replace_clone

Create a new clone of self
fun replace_with(node: ANode)

nitc :: ANode :: replace_with

Replace itself with an other node in the AST
fun root: ANode

nitc :: ANode :: root

The topmost ancestor of the element
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
private fun start_token: nullable Token

nitc :: Prod :: start_token

The token where the production really start (skipping ADoc).
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun to_xml: HTMLTag

nitc :: Prod :: to_xml

A XML representation of the AST
fun validate

nitc :: ANode :: validate

Recursively validate a AST node.
abstract fun visit_all(v: Visitor)

nitc :: ANode :: visit_all

Visit all nodes in order.
private abstract fun was_inline: Bool

nitc :: ANode :: was_inline

Does self was written in one line before transformation?
package_diagram nitc::AModule AModule nitc::Prod Prod nitc::AModule->nitc::Prod nitc::ANode ANode nitc::Prod->nitc::ANode ...nitc::ANode ... ...nitc::ANode->nitc::ANode

Ancestors

abstract class ANode

nitc :: ANode

Root of the AST class-hierarchy
interface Cloneable

core :: Cloneable

Something that can be cloned
interface Object

core :: Object

The root of the class hierarchy.

Parents

abstract class Prod

nitc :: Prod

Ancestor of all productions

Class definitions

nitc $ AModule
# The main node of a Nit source-file
class AModule
	super Prod

	# The declaration part of the module
	var n_moduledecl: nullable AModuledecl = null is writable

	# List of importation clauses
	var n_imports = new ANodes[AImport](self)

	# List of extern blocks
	var n_extern_code_blocks = new ANodes[AExternCodeBlock](self)

	# List of class definition (including top-level methods and the main)
	var n_classdefs = new ANodes[AClassdef](self)
end
src/parser/parser_nodes.nit:1136,1--1151,3

nitc :: parser_prod $ AModule
redef class AModule
	init init_amodule (
		n_moduledecl: nullable AModuledecl,
		n_imports: Collection[Object], # Should be Collection[AImport]
		n_extern_code_blocks: Collection[Object], # Should be Collection[AExternCodeBlock]
		n_classdefs: Collection[Object] # Should be Collection[AClassdef]
	)
	do
		_n_moduledecl = n_moduledecl
		if n_moduledecl != null then n_moduledecl.parent = self
		self.n_imports.unsafe_add_all(n_imports)
		self.n_extern_code_blocks.unsafe_add_all(n_extern_code_blocks)
		self.n_classdefs.unsafe_add_all(n_classdefs)
	end

	redef fun replace_child(old_child: ANode, new_child: nullable ANode)
	do
		if _n_moduledecl == old_child then
			n_moduledecl = new_child.as(nullable AModuledecl)
			return
		end
		if n_imports.replace_child(old_child, new_child) then return
		if n_extern_code_blocks.replace_child(old_child, new_child) then return
		if n_classdefs.replace_child(old_child, new_child) then return
	end

	redef fun n_moduledecl=(node)
	do
		_n_moduledecl = node
		if node != null then node.parent = self
	end


	redef fun visit_all(v: Visitor)
	do
		v.enter_visit(_n_moduledecl)
		n_imports.visit_all(v)
		n_extern_code_blocks.visit_all(v)
		n_classdefs.visit_all(v)
	end
end
src/parser/parser_prod.nit:9,1--49,3

nitc :: simple_misc_analysis $ AModule
redef class AModule
	# Visit the module to detect easy warnings that does not need the metamodel or the importation
	# Warnings are displayed on the toolcontext
	fun do_simple_misc_analysis(toolcontext: ToolContext)
	do
		var v = new SimpleMiscVisitor(toolcontext)
		v.enter_visit(self)

		var t = location.file.first_token
		while t != null do
			t.accept_simple_misc_token(v)
			t = t.next_token
		end
	end
end
src/frontend/simple_misc_analysis.nit:36,1--50,3

nitc :: literal $ AModule
redef class AModule
	# Visit the module to compute the real value of the literal-related node of the AST.
	# Warnings and errors are displayed on the toolcontext.
	fun do_literal(toolcontext: ToolContext)
	do
		var v = new LiteralVisitor(toolcontext)
		v.enter_visit(self)
	end
end
src/literal.nit:33,1--41,3

nitc :: loader $ AModule
redef class AModule
	# The associated MModule once build by a `ModelBuilder`
	var mmodule: nullable MModule = null

	# Flag that indicate if the importation is already completed
	var is_importation_done: Bool = false
end
src/loader.nit:1282,1--1288,3

nitc :: modelize_class $ AModule
redef class AModule
	# Flag that indicate if the class building is already completed
	var build_classes_is_done: Bool = false
	# What is the AClassdef associated to a `MClass`?
	# Used to check multiple definition of a class.
	var mclass2nclassdef: Map[MClass, AClassdef] = new HashMap[MClass, AClassdef]
end
src/modelize/modelize_class.nit:505,1--511,3

nitc :: pretty $ AModule
redef class AModule
	redef fun accept_pretty_printer(v) do
		v.catch_up start_token
		v.visit n_moduledecl

		if not n_imports.is_empty then
			if v.skip_empty then v.addn

			for n_import in n_imports do
				v.catch_up n_import
				v.visit n_import
			end
		end

		if not n_extern_code_blocks.is_empty then
			v.addn

			for n_extern_block in n_extern_code_blocks do
				v.catch_up n_extern_block
				v.visit n_extern_block
				v.addn
				if n_extern_block != n_extern_code_blocks.last then v.addn
			end

			if not n_classdefs.is_empty then v.addn
		end

		if not n_classdefs.is_empty then
			if v.skip_empty then v.addn

			for n_classdef in n_classdefs do
				v.catch_up n_classdef
				v.visit n_classdef
				if n_classdef != n_classdefs.last then v.addn
			end
		end

		assert v.indent == 0
	end

	# Skip doc if any.
	redef fun start_token do
		if n_moduledecl != null then return n_moduledecl.first_token
		if not n_imports.is_empty then return n_imports.first.first_token
		if not n_classdefs.is_empty then return n_classdefs.first.first_token
		return first_token
	end

	redef fun is_inlinable do return false
end
src/pretty.nit:552,1--601,3

nitc :: light_ffi $ AModule
redef class AModule

	# Ensures all of the general foreign code of the module has been analyzed.
	# Manages header blocks, extern class types and foreign dependancies between modules
	fun ensure_compile_ffi_wrapper
	do
		var mmodule = mmodule
		if mmodule == null or mmodule.ffi_ccu != null then return

		# ready extern code compiler
		var ffi_ccu = new CCompilationUnit
		mmodule.ffi_ccu = ffi_ccu

		# generate code
		for block in n_extern_code_blocks do
			var language = block.language
			assert language != null
			mmodule.present_languages.add(language)
			language.compile_module_block(block, ffi_ccu, mmodule)
		end

		ffi_ccu.header_c_base.add( "#include \"{mmodule.c_name}._nitni.h\"\n" )

		ffi_ccu.body_decl.add("#ifdef ANDROID\n")
		ffi_ccu.body_decl.add("	#include <android/log.h>\n")
		ffi_ccu.body_decl.add("	#define PRINT_ERROR(...) (void)__android_log_print(ANDROID_LOG_WARN, \"Nit\", __VA_ARGS__)\n")
		ffi_ccu.body_decl.add("#else\n")
		ffi_ccu.body_decl.add("	#define PRINT_ERROR(...) fprintf(stderr, __VA_ARGS__)\n")
		ffi_ccu.body_decl.add("#endif\n")

		for nclassdef in n_classdefs do
			# Does it declares an extern type?
			if nclassdef isa AStdClassdef and nclassdef.n_extern_code_block != null then
				mmodule.uses_ffi = true
				var language = nclassdef.n_extern_code_block.language
				assert language != null
				mmodule.present_languages.add(language)
				nclassdef.n_extern_code_block.language.compile_extern_class(
					nclassdef.n_extern_code_block.as(not null), nclassdef, ffi_ccu, mmodule)
			end
		end
	end
end
src/ffi/light_ffi.nit:72,1--114,3

nitc :: serialization_model_phase $ AModule
redef class AModule
	private fun deserializer_nclassdef: nullable AStdClassdef
	do
		for nclassdef in n_classdefs do
			if not nclassdef isa AStdClassdef then continue
			var n_qid = nclassdef.n_qid
			if n_qid != null and n_qid.n_id.text == "Deserializer" then return nclassdef
		end

		return null
	end

	private var inits_to_retype = new Array[AMethPropdef]

	redef fun is_serialize
	do
		var n_moduledecl = n_moduledecl
		return n_moduledecl != null and n_moduledecl.is_serialize
	end

	# `AStdClassdef` marked as serializable, itself or one of theur attribute
	private var auto_serializable_nclassdefs: Array[AStdClassdef] is lazy do
		var array = new Array[AStdClassdef]
		for nclassdef in n_classdefs do
			if nclassdef isa AStdClassdef and nclassdef.how_serialize != null then
				array.add nclassdef
			end
		end
		return array
	end
end
src/frontend/serialization_model_phase.nit:290,1--320,3

nitc :: header_dependency $ AModule
redef class AModule
	private fun has_public_c_header: Bool do
		for code_block in n_extern_code_blocks do if code_block.is_c_header then return true
		return false
	end
end
src/ffi/header_dependency.nit:28,1--33,3

nitc :: contracts $ AModule
redef class AModule
	# Compile all contracts
	#
	# The implementation of the contracts is done in two visits.
	#
	# - First step, the visitor analyzes and constructs the contracts
	#   for each class (invariant) and method (expect, ensure).
	#
	# - Second step the visitor analyzes each `ASendExpr` to see
	#   if the callsite calls a method with a contract. If this is
	#	the case the callsite is replaced by another callsite to the contract method.
	fun do_contracts(toolcontext: ToolContext) do
		#
		var contract_visitor = new ContractsVisitor(toolcontext, toolcontext.modelbuilder.identified_modules.first, self, new ASTBuilder(mmodule.as(not null)))
		contract_visitor.enter_visit(self)
		#
		var callsite_visitor = new CallSiteVisitor(toolcontext)
		callsite_visitor.enter_visit(self)
	end
end
src/contracts.nit:47,1--66,3

nitc :: on_demand_compiler $ AModule
redef class AModule

	# Compile user FFI code and a standardized API into a `.so` file
	#
	# Returns `true` on success.
	fun compile_foreign_lib(v: NaiveInterpreter): Bool
	do
		var mmodule = mmodule
		assert mmodule != null

		var compile_dir = v.compile_dir
		var foreign_code_lib_path = v.foreign_code_lib_path(mmodule)

		if not compile_dir.file_exists then compile_dir.mkdir(0o700)

		# Compile the common FFI part
		ensure_compile_ffi_wrapper
		for mclassdef in mmodule.mclassdefs do for mpropdef in mclassdef.mpropdefs do
			var anode = v.modelbuilder.mpropdef2node(mpropdef)
			if mpropdef isa MMethodDef and anode isa AMethPropdef and anode.supported_by_dynamic_ffi then
				anode.compile_ffi_method(mmodule)
			end
		end
		mmodule.finalize_ffi_wrapper(compile_dir, mmodule)

		# Compile the standard API and its implementation for the .so file
		var ccu = compile_foreign_lib_api(compile_dir)

		var srcs = [for file in ccu.files do new ExternCFile(file, ""): ExternFile]
		srcs.add_all mmodule.ffi_files

		# Compiler options specific to this module
		var ldflags_array = mmodule.ldflags[""]
		if ldflags_array.has("-lrt") and system("sh -c 'uname -s 2>/dev/null || echo not' | grep Darwin >/dev/null") == 0 then
			# Remove -lrt on OS X
			ldflags_array.remove "-lrt"
		end
		var ldflags = ldflags_array.join(" ")

		# Protect pkg-config
		var pkgconfigs = mmodule.pkgconfigs
		var pkg_cflags = ""
		if not pkgconfigs.is_empty then

			# Check if the pkgconfig packages are available
			v.modelbuilder.toolcontext.check_pkgconfig_packages pkgconfigs
			if not v.modelbuilder.toolcontext.check_errors then return false

			pkg_cflags = "`pkg-config --cflags {pkgconfigs.join(" ")}`"
			ldflags += " `pkg-config --libs {pkgconfigs.join(" ")}`"
		end

		# Compile each source file to an object file (or equivalent)
		var object_files = new Array[String]
		for f in srcs do
			f.compile(v, mmodule, object_files, pkg_cflags)
		end

		# Link everything in a shared library
		var cmd = "{v.c_compiler} -Wall -shared -o {foreign_code_lib_path} {object_files.join(" ")} {ldflags}"
		if system(cmd) != 0 then
			v.fatal "FFI Error: Failed to link native code using `{cmd}`"
			return false
		end

		return true
	end

	# Compile the standard API of the `.so` file
	#
	# * The shared structure `nit_call_arg`.
	# * Standardized implementation functions entrypoints that relay calls
	#   to the FFI implementation functions.
	private fun compile_foreign_lib_api(compdir: String): CCompilationUnit
	do
		var mmodule = mmodule
		assert mmodule != null

		# ready extern code compiler
		var ecc = new CCompilationUnit

		ecc.body_decl.add """

#include <string.h>
#include <stdio.h>
#include <inttypes.h>

// C structure behind `CallArg` from the interpreter
typedef union nit_call_arg {
	long value_Int;
	int value_Bool;
	uint32_t value_Char;
	uint8_t value_Byte;
	int8_t value_Int8;
	int16_t value_Int16;
	uint16_t value_UInt16;
	int32_t value_Int32;
	uint32_t value_UInt32;
	double value_Float;
	void* value_Pointer;
} nit_call_arg;

"""

		# types
		var used_types = collect_mtypes
		for t in used_types do
			if not t.is_cprimitive then
				ecc.header_c_types.add "typedef void* {t.cname};\n"
			end
		end

		# TODO callbacks & casts

		for nclassdef in n_classdefs do for npropdef in nclassdef.n_propdefs do
			if npropdef isa AMethPropdef and npropdef.supported_by_dynamic_ffi then
				npropdef.mpropdef.compile_foreign_code_entry ecc
			end
		end

		ecc.write_as_foreign_lib_api(mmodule, compdir)

		return ecc
	end

	# Collect all `MType` use in extern methods within this module
	private fun collect_mtypes: Set[MType]
	do
		var used_types = new HashSet[MType]

		# collect callbacks
		for nclassdef in n_classdefs do for npropdef in nclassdef.n_propdefs do
			if npropdef isa AMethPropdef and npropdef.supported_by_dynamic_ffi then
				var fcs = npropdef.foreign_callbacks
				used_types.add_all fcs.types
			end
		end

		return used_types
	end
end
src/interpreter/dynamic_loading_ffi/on_demand_compiler.nit:98,1--238,3

nitc :: dynamic_loading_ffi $ AModule
redef class AModule

	private var foreign_code_lib_cache: nullable ForeignCodeLib = null

	# Handle to the external library with FFI code
	private fun foreign_code_lib(v: NaiveInterpreter): nullable ForeignCodeLib
	do
		var lib = foreign_code_lib_cache
		if lib != null then return lib

		var mmodule = mmodule
		assert mmodule != null

		var foreign_code_lib_path = v.foreign_code_lib_path(mmodule)

		# Compile lib
		compile_foreign_lib v

		lib = new ForeignCodeLib.dlopen(foreign_code_lib_path.to_cstring)
		if lib.address_is_null then
			v.fatal "FFI Error: Cannot load foreign code library for {mmodule.name}: {dlerror.to_s}"
			return null
		end

		foreign_code_lib_cache = lib
		return lib
	end
end
src/interpreter/dynamic_loading_ffi/dynamic_loading_ffi.nit:325,1--352,3