An explicit instantiation. eg new T

Introduced properties

private var _callsite: nullable CallSite

nitc :: ANewExpr :: _callsite

The constructor invoked by the new.
private var _n_args: AExprs

nitc :: ANewExpr :: _n_args

The arguments of the new
private var _n_kwnew: TKwnew

nitc :: ANewExpr :: _n_kwnew

The new keyword
private var _n_qid: nullable AQid

nitc :: ANewExpr :: _n_qid

The name of the named-constructor, if any
private var _n_type: AType

nitc :: ANewExpr :: _n_type

The type keyword
private var _recvtype: nullable MClassType

nitc :: ANewExpr :: _recvtype

The designated type
fun callsite: nullable CallSite

nitc :: ANewExpr :: callsite

The constructor invoked by the new.
protected fun callsite=(callsite: nullable CallSite)

nitc :: ANewExpr :: callsite=

The constructor invoked by the new.
init init_anewexpr(n_kwnew: nullable TKwnew, n_type: nullable AType, n_qid: nullable AQid, n_args: nullable AExprs)

nitc :: ANewExpr :: init_anewexpr

private init make(callsite: CallSite, args: nullable Array[AExpr])

nitc :: ANewExpr :: make

fun n_args: AExprs

nitc :: ANewExpr :: n_args

The arguments of the new
fun n_args=(n_args: AExprs)

nitc :: ANewExpr :: n_args=

The arguments of the new
fun n_kwnew: TKwnew

nitc :: ANewExpr :: n_kwnew

The new keyword
fun n_kwnew=(n_kwnew: TKwnew)

nitc :: ANewExpr :: n_kwnew=

The new keyword
fun n_qid: nullable AQid

nitc :: ANewExpr :: n_qid

The name of the named-constructor, if any
fun n_qid=(n_qid: nullable AQid)

nitc :: ANewExpr :: n_qid=

The name of the named-constructor, if any
fun n_type: AType

nitc :: ANewExpr :: n_type

The type keyword
fun n_type=(n_type: AType)

nitc :: ANewExpr :: n_type=

The type keyword
fun recvtype: nullable MClassType

nitc :: ANewExpr :: recvtype

The designated type
protected fun recvtype=(recvtype: nullable MClassType)

nitc :: ANewExpr :: recvtype=

The designated type

Redefined properties

redef type SELF: ANewExpr

nitc $ ANewExpr :: SELF

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

nitc :: pretty $ ANewExpr :: accept_pretty_printer

Start visit of self using a PrettyPrinterVisitor
redef fun decorate_tag(v: HtmlightVisitor, res: HTMLTag, token: Token): nullable HInfoBox

nitc :: htmlight $ ANewExpr :: decorate_tag

Add aditionnal information on a child-token and return an additionnal HInfoBox on it
redef fun dump_info(v: ASTDump): String

nitc :: typing $ ANewExpr :: dump_info

Information to display on a node
redef fun expr(v: JavaCompilerVisitor): nullable RuntimeVariable

nitc :: java_compiler $ ANewExpr :: expr

Try to compile self as an expression
redef fun expr(v: NaiveInterpreter): nullable Instance

nitc :: naive_interpreter $ ANewExpr :: expr

Evaluate the node as a possible expression.
redef fun expr(v: AbstractCompilerVisitor): nullable RuntimeVariable

nitc :: abstract_compiler $ ANewExpr :: expr

Try to compile self as an expression
redef fun generate_basic_blocks(ssa: SSA, old_block: BasicBlock): BasicBlock

nitc :: ssa $ ANewExpr :: generate_basic_blocks

Generate recursively basic block for this expression
redef fun is_inlinable: Bool

nitc :: pretty $ ANewExpr :: is_inlinable

Is self printable in one line?
redef fun n_args=(node: AExprs)

nitc :: parser_prod $ ANewExpr :: n_args=

The arguments of the new
redef fun n_kwnew=(node: TKwnew)

nitc :: parser_prod $ ANewExpr :: n_kwnew=

The new keyword
redef fun n_qid=(node: nullable AQid)

nitc :: parser_prod $ ANewExpr :: n_qid=

The name of the named-constructor, if any
redef fun n_type=(node: AType)

nitc :: parser_prod $ ANewExpr :: n_type=

The type keyword
redef fun replace_child(old_child: ANode, new_child: nullable ANode)

nitc :: parser_prod $ ANewExpr :: replace_child

Replace a child with an other node in the AST
redef fun visit_all(v: Visitor)

nitc :: parser_prod $ ANewExpr :: 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 _after_flow_context: nullable FlowContext

nitc :: AExpr :: _after_flow_context

The flow after the full evaluation of the expression/statement
private var _callsite: nullable CallSite

nitc :: ANewExpr :: _callsite

The constructor invoked by the new.
private var _comprehension: nullable AArrayExpr

nitc :: AExpr :: _comprehension

Is non-null if self is a leaf of a comprehension array construction.
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 _implicit_cast_to: nullable MType

nitc :: AExpr :: _implicit_cast_to

If required, the following implicit cast .as(XXX)
private var _is_broken: Bool

nitc :: ANode :: _is_broken

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

nitc :: AExpr :: _is_typed

Is the statement correctly typed?
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 _mtype: nullable MType

nitc :: AExpr :: _mtype

The static type of the expression.
private var _n_annotations: nullable AAnnotations

nitc :: Prod :: _n_annotations

All the annotations attached directly to the node
private var _n_args: AExprs

nitc :: ANewExpr :: _n_args

The arguments of the new
private var _n_kwnew: TKwnew

nitc :: ANewExpr :: _n_kwnew

The new keyword
private var _n_qid: nullable AQid

nitc :: ANewExpr :: _n_qid

The name of the named-constructor, if any
private var _n_type: AType

nitc :: ANewExpr :: _n_type

The type keyword
private var _parent: nullable ANode

nitc :: ANode :: _parent

Parent of the node in the AST
private var _recvtype: nullable MClassType

nitc :: ANewExpr :: _recvtype

The designated type
private var _vararg_decl: Int

nitc :: AExpr :: _vararg_decl

It indicates the number of arguments collected as a vararg.
private var _variable_cache: nullable Variable

nitc :: AExpr :: _variable_cache

private fun accept_explain_assert(v: ExplainAssertVisitor)

nitc :: AExpr :: accept_explain_assert

Fill v to explain this node if the parent assert fails
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.
fun add(expr: AExpr)

nitc :: AExpr :: add

Add expr at the end of the block
fun after_flow_context: nullable FlowContext

nitc :: AExpr :: after_flow_context

The flow after the full evaluation of the expression/statement
protected fun after_flow_context=(after_flow_context: nullable FlowContext)

nitc :: AExpr :: after_flow_context=

The flow after the full evaluation of the expression/statement
fun allocate_mtype(v: RapidTypeVisitor)

nitc :: AExpr :: allocate_mtype

Make the mtype of the expression live
fun as_id: nullable String

nitc :: AExpr :: as_id

Get self as a single identifier.
fun as_int: nullable Int

nitc :: AExpr :: as_int

Get self as an Int.
fun as_string: nullable String

nitc :: AExpr :: as_string

Get self as a String.
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 callsite: nullable CallSite

nitc :: ANewExpr :: callsite

The constructor invoked by the new.
protected fun callsite=(callsite: nullable CallSite)

nitc :: ANewExpr :: callsite=

The constructor invoked by the new.
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.
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 comprehension: nullable AArrayExpr

nitc :: AExpr :: comprehension

Is non-null if self is a leaf of a comprehension array construction.
protected fun comprehension=(comprehension: nullable AArrayExpr)

nitc :: AExpr :: comprehension=

Is non-null if self is a leaf of a comprehension array construction.
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
fun detach_with_placeholder: AExpr

nitc :: AExpr :: detach_with_placeholder

The detach method completely remove the node in the parent.
private fun do_cloneable(v: CloneVisitor)

nitc :: ANode :: do_cloneable

fun do_typing(modelbuilder: ModelBuilder, visited_mpropdef: MPropDef)

nitc :: AExpr :: do_typing

Type the expression as if located in visited_mpropdef
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.
private fun expr(v: AbstractCompilerVisitor): nullable RuntimeVariable

nitc :: AExpr :: expr

Try to compile self as an expression
protected fun expr(v: NaiveInterpreter): nullable Instance

nitc :: AExpr :: expr

Evaluate the node as a possible expression.
private fun expr(v: JavaCompilerVisitor): nullable RuntimeVariable

nitc :: AExpr :: expr

Try to compile self as an expression
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.
fun generate_basic_blocks(ssa: SSA, old_block: BasicBlock): BasicBlock

nitc :: AExpr :: generate_basic_blocks

Generate recursively basic block for this expression
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 implicit_cast_to: nullable MType

nitc :: AExpr :: implicit_cast_to

If required, the following implicit cast .as(XXX)
protected fun implicit_cast_to=(implicit_cast_to: nullable MType)

nitc :: AExpr :: implicit_cast_to=

If required, the following implicit cast .as(XXX)
fun infobox(v: HtmlightVisitor): nullable HInfoBox

nitc :: ANode :: infobox

Return a optional infobox
init init

core :: Object :: init

init init_anewexpr(n_kwnew: nullable TKwnew, n_type: nullable AType, n_qid: nullable AQid, n_args: nullable AExprs)

nitc :: ANewExpr :: init_anewexpr

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.
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 is_typed: Bool

nitc :: AExpr :: is_typed

Is the statement correctly typed?
protected fun is_typed=(is_typed: Bool)

nitc :: AExpr :: is_typed=

Is the statement correctly typed?
fun its_variable: nullable Variable

nitc :: AExpr :: its_variable

Return the variable read (if any)
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.
private init make(callsite: CallSite, args: nullable Array[AExpr])

nitc :: ANewExpr :: make

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 make_var_read: AVarExpr

nitc :: AExpr :: make_var_read

Return a new variable read that contains the value of the expression
fun mtype: nullable MType

nitc :: AExpr :: mtype

The static type of the expression.
protected fun mtype=(mtype: nullable MType)

nitc :: AExpr :: mtype=

The static type of the expression.
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_args: AExprs

nitc :: ANewExpr :: n_args

The arguments of the new
fun n_args=(n_args: AExprs)

nitc :: ANewExpr :: n_args=

The arguments of the new
fun n_kwnew: TKwnew

nitc :: ANewExpr :: n_kwnew

The new keyword
fun n_kwnew=(n_kwnew: TKwnew)

nitc :: ANewExpr :: n_kwnew=

The new keyword
fun n_qid: nullable AQid

nitc :: ANewExpr :: n_qid

The name of the named-constructor, if any
fun n_qid=(n_qid: nullable AQid)

nitc :: ANewExpr :: n_qid=

The name of the named-constructor, if any
fun n_type: AType

nitc :: ANewExpr :: n_type

The type keyword
fun n_type=(n_type: AType)

nitc :: ANewExpr :: n_type=

The type keyword
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
fun numbering(v: VirtualMachine, position: Int): Int

nitc :: AExpr :: numbering

Give a position to each variable declared in the node.
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
fun recvtype: nullable MClassType

nitc :: ANewExpr :: recvtype

The designated type
protected fun recvtype=(recvtype: nullable MClassType)

nitc :: ANewExpr :: recvtype=

The designated type
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).
protected fun stmt(v: NaiveInterpreter)

nitc :: AExpr :: stmt

Evaluate the node as a statement.
private fun stmt(v: AbstractCompilerVisitor)

nitc :: AExpr :: stmt

Try to compile self as a statement
private fun stmt(v: JavaCompilerVisitor)

nitc :: AExpr :: stmt

Try to compile self as a statement
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.
fun vararg_decl: Int

nitc :: AExpr :: vararg_decl

It indicates the number of arguments collected as a vararg.
protected fun vararg_decl=(vararg_decl: Int)

nitc :: AExpr :: vararg_decl=

It indicates the number of arguments collected as a vararg.
private fun variable_cache: nullable Variable

nitc :: AExpr :: variable_cache

private fun variable_cache=(variable_cache: nullable Variable)

nitc :: AExpr :: variable_cache=

abstract fun visit_all(v: Visitor)

nitc :: ANode :: visit_all

Visit all nodes in order.
private fun warn_parentheses(v: SimpleMiscVisitor)

nitc :: AExpr :: warn_parentheses

Warn in case of superfluous parentheses
private abstract fun was_inline: Bool

nitc :: ANode :: was_inline

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

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.
abstract class Prod

nitc :: Prod

Ancestor of all productions

Parents

abstract class AExpr

nitc :: AExpr

Expression and statements

Class definitions

nitc $ ANewExpr
# An explicit instantiation. eg `new T`
class ANewExpr
	super AExpr

	# The `new` keyword
	var n_kwnew: TKwnew is writable, noinit

	# The `type` keyword
	var n_type: AType is writable, noinit

	# The name of the named-constructor, if any
	var n_qid: nullable AQid = null is writable

	# The arguments of the `new`
	var n_args: AExprs is writable, noinit
end
src/parser/parser_nodes.nit:2373,1--2388,3

nitc :: parser_prod $ ANewExpr
redef class ANewExpr
	init init_anewexpr (
		n_kwnew: nullable TKwnew,
		n_type: nullable AType,
		n_qid: nullable AQid,
		n_args: nullable AExprs
	)
	do
		_n_kwnew = n_kwnew.as(not null)
		n_kwnew.parent = self
		_n_type = n_type.as(not null)
		n_type.parent = self
		_n_qid = n_qid
		if n_qid != null then n_qid.parent = self
		_n_args = n_args.as(not null)
		n_args.parent = self
	end

	redef fun replace_child(old_child: ANode, new_child: nullable ANode)
	do
		if _n_kwnew == old_child then
			n_kwnew = new_child.as(TKwnew)
			return
		end
		if _n_type == old_child then
			n_type = new_child.as(AType)
			return
		end
		if _n_qid == old_child then
			n_qid = new_child.as(nullable AQid)
			return
		end
		if _n_args == old_child then
			n_args = new_child.as(AExprs)
			return
		end
	end

	redef fun n_kwnew=(node)
	do
		_n_kwnew = node
		node.parent = self
	end
	redef fun n_type=(node)
	do
		_n_type = node
		node.parent = self
	end
	redef fun n_qid=(node)
	do
		_n_qid = node
		if node != null then node.parent = self
	end
	redef fun n_args=(node)
	do
		_n_args = node
		node.parent = self
	end


	redef fun visit_all(v: Visitor)
	do
		v.enter_visit(_n_kwnew)
		v.enter_visit(_n_type)
		v.enter_visit(_n_qid)
		v.enter_visit(_n_args)
	end
end
src/parser/parser_prod.nit:5135,1--5202,3

nitc :: pretty $ ANewExpr
redef class ANewExpr
	redef fun accept_pretty_printer(v) do
		var can_inline = v.can_inline(self)
		v.visit n_kwnew
		v.adds
		v.visit n_type

		if n_qid != null then
			v.consume "."

			if not can_inline then
				v.forcen
				v.indent += 1
				v.addt
				v.indent -= 1
			end

			v.visit n_qid
		end

		v.visit_args n_args.n_exprs
	end

	redef fun is_inlinable do return true
end
src/pretty.nit:1734,1--1758,3

nitc :: typing $ ANewExpr
redef class ANewExpr
	# The constructor invoked by the new.
	var callsite: nullable CallSite

	# The designated type
	var recvtype: nullable MClassType

	redef fun accept_typing(v)
	do
		var recvtype = v.resolve_mtype(self.n_type)
		if recvtype == null then return

		if not recvtype isa MClassType then
			if recvtype isa MNullableType then
				v.error(self, "Type Error: cannot instantiate the nullable type `{recvtype}`.")
				return
			else if recvtype isa MFormalType then
				v.error(self, "Type Error: cannot instantiate the formal type `{recvtype}`.")
				return
			else
				v.error(self, "Type Error: cannot instantiate the type `{recvtype}`.")
				return
			end
		end

		self.recvtype = recvtype
		var kind = recvtype.mclass.kind

		var name: String
		var nqid = self.n_qid
		var node: ANode
		if nqid != null then
			name = nqid.n_id.text
			node = nqid
		else
			name = "new"
			node = self.n_kwnew
		end
		if name == "intern" then
			if kind != concrete_kind then
				v.error(self, "Type Error: cannot instantiate {kind} {recvtype}.")
				return
			end
			if n_args.n_exprs.not_empty then
				v.error(n_args, "Type Error: the intern constructor expects no arguments.")
				return
			end
			# Our job is done
			self.mtype = recvtype
			return
		end

		var callsite = v.build_callsite_by_name(node, recvtype, name, false)
		if callsite == null then return

		if not callsite.mproperty.is_new then
			if kind != concrete_kind then
				v.error(self, "Type Error: cannot instantiate {kind} `{recvtype}`.")
				return
			end
			self.mtype = recvtype
		else
			self.mtype = callsite.msignature.return_mtype
			assert self.mtype != null
		end

		self.callsite = callsite

		if not callsite.mproperty.is_init_for(recvtype.mclass) then
			v.error(self, "Error: `{name}` is not a constructor.")
			return
		end

		var args = n_args.to_a
		callsite.check_signature(v, node, args)
	end

	redef fun dump_info(v) do
		var res = super
		var callsite = self.callsite
		if callsite != null then
			res += v.yellow(" call="+callsite.dump_info(v))
		end
		return res
	end
end
src/semantize/typing.nit:2399,1--2484,3

nitc :: astbuilder $ ANewExpr
redef class ANewExpr
	private init make(callsite: CallSite, args: nullable Array[AExpr])
	do
		_n_kwnew = new TKwnew
		_n_type = new AType.make
		_n_args = new AListExprs
		if args != null then
			n_args.n_exprs.add_all(args)
		end
		self.callsite = callsite
		self.recvtype = callsite.recv.as(MClassType)
		if callsite.mproperty.is_new then
			self.mtype = callsite.msignature.return_mtype
		else
			self.mtype = callsite.recv
		end
		self.is_typed = true
	end
end
src/astbuilder.nit:600,1--618,3

nitc :: rapid_type_analysis $ ANewExpr
redef class ANewExpr
	redef fun accept_rapid_type_visitor(v)
	do
		var mtype = self.recvtype.as(not null)
		v.add_type(mtype)
		v.add_callsite(callsite)
	end
end
src/rapid_type_analysis.nit:770,1--777,3

nitc :: naive_interpreter $ ANewExpr
redef class ANewExpr
	redef fun expr(v)
	do
		var mtype = v.unanchor_type(self.recvtype.as(not null))
		var recv: Instance = new MutableInstance(mtype)
		v.init_instance(recv)
		var callsite = self.callsite
		if callsite == null then return recv

		var args = v.varargize(callsite.mpropdef, callsite.signaturemap, recv, self.n_args.n_exprs)
		if args == null then return null
		var res2 = v.callsite(callsite, args)
		if res2 != null then
			#self.debug("got {res2} from {mproperty}. drop {recv}")
			return res2
		end
		return recv
	end
end
src/interpreter/naive_interpreter.nit:2374,1--2392,3

nitc :: abstract_compiler $ ANewExpr
redef class ANewExpr
	redef fun expr(v)
	do
		var mtype = self.recvtype
		assert mtype != null

		if mtype.mclass.name == "NativeArray" then
			assert self.n_args.n_exprs.length == 1
			var l = v.expr(self.n_args.n_exprs.first, null)
			assert mtype isa MGenericType
			var elttype = mtype.arguments.first
			return v.native_array_instance(elttype, l)
		end

		var callsite = self.callsite
		if callsite == null then return v.init_instance_or_extern(mtype)
		if callsite.is_broken then return null

		var recv
		# new factories are badly implemented.
		# They assume a stub temporary receiver exists.
		# This temporary receiver is required because it
		# currently holds the method and the formal types.
		#
		# However, this object could be reused if the formal types are the same.
		# Therefore, the following code will `once` it in these case
		if callsite.mproperty.is_new and not mtype.need_anchor then
			var name = v.get_name("varoncenew")
			var guard = v.get_name(name + "_guard")
			v.add_decl("static {mtype.ctype} {name};")
			v.add_decl("static int {guard};")
			recv = v.new_var(mtype)
			v.add("if (likely({guard})) \{")
			v.add("{recv} = {name};")
			v.add("\} else \{")
			var i = v.init_instance_or_extern(mtype)
			v.add("{recv} = {i};")
			v.add("{name} = {recv};")
			v.add("{guard} = 1;")
			v.add("\}")
		else
			recv = v.init_instance_or_extern(mtype)
		end

		var args = v.varargize(callsite.mpropdef, callsite.signaturemap, recv, self.n_args.n_exprs)
		var res2 = v.compile_callsite(callsite, args)
		if res2 != null then
			#self.debug("got {res2} from {mproperty}. drop {recv}")
			return res2
		end
		return recv
	end
end
src/compiler/abstract_compiler.nit:4493,1--4545,3

nitc :: ssa $ ANewExpr
redef class ANewExpr
	redef fun generate_basic_blocks(ssa, old_block)
	do
		for e in self.n_args.n_exprs do e.generate_basic_blocks(ssa, old_block)

		ssa.propdef.object_sites.add(self)

		return old_block
	end
end
src/ssa.nit:878,1--887,3

nitc :: contracts $ ANewExpr
redef class ANewExpr
	redef fun check_callsite(v)
	do
		var actual_callsite = callsite
		if actual_callsite != null then
			callsite = v.drive_method_contract(actual_callsite)
		end
	end
end
src/contracts.nit:926,1--934,3

nitc :: htmlight $ ANewExpr
redef class ANewExpr
	redef fun decorate_tag(v, res, token)
	do
		var callsite = self.callsite
		if callsite == null then return null
		return callsite.infobox(v)
	end
end
src/htmlight.nit:910,1--917,3

nitc :: java_compiler $ ANewExpr
redef class ANewExpr
	redef fun expr(v)
	do
		var mtype = self.recvtype
		assert mtype != null

		if mtype.mclass.name == "NativeArray" then
			# TODO handle native arrays
			v.info("NOT YET IMPLEMENTED new NativeArray")
		end

		var recv = v.init_instance(mtype)

		var callsite = self.callsite
		if callsite == null then return recv

		var args = v.varargize(callsite.mpropdef, callsite.signaturemap, recv, self.n_args.n_exprs)
		var res2 = v.compile_callsite(callsite, args)
		if res2 != null then
			return res2
		end
		return recv
	end
end
src/compiler/java_compiler.nit:1941,1--1964,3