A signature in a method definition. eg (x,y:X,z:Z):T

Introduced properties

private var _is_visited: Bool

nitc :: ASignature :: _is_visited

Is the model builder has correctly visited the signature
private var _n_cpar: nullable TCpar

nitc :: ASignature :: _n_cpar

The ) symbol
private var _n_opar: nullable TOpar

nitc :: ASignature :: _n_opar

The ( symbol
private var _n_params: ANodes[AParam]

nitc :: ASignature :: _n_params

The list of parameters
private var _n_type: nullable AType

nitc :: ASignature :: _n_type

The return type
private var _param_names: Array[String]

nitc :: ASignature :: _param_names

Names of parameters from the AST
private var _param_types: Array[MType]

nitc :: ASignature :: _param_types

Types of parameters from the AST
private var _ret_type: nullable MType

nitc :: ASignature :: _ret_type

Return type
private var _vararg_rank: Int

nitc :: ASignature :: _vararg_rank

Rank of the vararg (of -1 if none)
private fun adapt_to_contract: ASignature

nitc :: ASignature :: adapt_to_contract

Create a new ASignature adapted for contract
private fun adapt_to_ensurecondition: ASignature

nitc :: ASignature :: adapt_to_ensurecondition

Create a new ASignature adapted for ensure
private fun check_signature(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool

nitc :: ASignature :: check_signature

init init_asignature(n_opar: nullable TOpar, n_params: Collection[Object], n_cpar: nullable TCpar, n_type: nullable AType)

nitc :: ASignature :: init_asignature

fun is_visited: Bool

nitc :: ASignature :: is_visited

Is the model builder has correctly visited the signature
protected fun is_visited=(is_visited: Bool)

nitc :: ASignature :: is_visited=

Is the model builder has correctly visited the signature
private fun make_parameter_read(ast_builder: ASTBuilder): Array[AVarExpr]

nitc :: ASignature :: make_parameter_read

Create an array of AVarExpr representing the read of every parameters
fun n_cpar: nullable TCpar

nitc :: ASignature :: n_cpar

The ) symbol
fun n_cpar=(n_cpar: nullable TCpar)

nitc :: ASignature :: n_cpar=

The ) symbol
fun n_opar: nullable TOpar

nitc :: ASignature :: n_opar

The ( symbol
fun n_opar=(n_opar: nullable TOpar)

nitc :: ASignature :: n_opar=

The ( symbol
fun n_params: ANodes[AParam]

nitc :: ASignature :: n_params

The list of parameters
protected fun n_params=(n_params: ANodes[AParam])

nitc :: ASignature :: n_params=

The list of parameters
fun n_type: nullable AType

nitc :: ASignature :: n_type

The return type
fun n_type=(n_type: nullable AType)

nitc :: ASignature :: n_type=

The return type
fun param_names: Array[String]

nitc :: ASignature :: param_names

Names of parameters from the AST
protected fun param_names=(param_names: Array[String])

nitc :: ASignature :: param_names=

Names of parameters from the AST
fun param_types: Array[MType]

nitc :: ASignature :: param_types

Types of parameters from the AST
protected fun param_types=(param_types: Array[MType])

nitc :: ASignature :: param_types=

Types of parameters from the AST
fun ret_type: nullable MType

nitc :: ASignature :: ret_type

Return type
protected fun ret_type=(ret_type: nullable MType)

nitc :: ASignature :: ret_type=

Return type
fun vararg_rank: Int

nitc :: ASignature :: vararg_rank

Rank of the vararg (of -1 if none)
protected fun vararg_rank=(vararg_rank: Int)

nitc :: ASignature :: vararg_rank=

Rank of the vararg (of -1 if none)
private fun visit_signature(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool

nitc :: ASignature :: visit_signature

Visit and fill information about a signature

Redefined properties

redef type SELF: ASignature

nitc $ ASignature :: SELF

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

nitc :: pretty $ ASignature :: accept_pretty_printer

Start visit of self using a PrettyPrinterVisitor
redef fun clone: SELF

nitc :: astbuilder $ ASignature :: clone

Duplicate self
redef fun n_cpar=(node: nullable TCpar)

nitc :: parser_prod $ ASignature :: n_cpar=

The ) symbol
redef fun n_opar=(node: nullable TOpar)

nitc :: parser_prod $ ASignature :: n_opar=

The ( symbol
redef fun n_type=(node: nullable AType)

nitc :: parser_prod $ ASignature :: n_type=

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

nitc :: parser_prod $ ASignature :: replace_child

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

nitc :: parser_prod $ ASignature :: 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 _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_visited: Bool

nitc :: ASignature :: _is_visited

Is the model builder has correctly visited the signature
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 _n_annotations: nullable AAnnotations

nitc :: Prod :: _n_annotations

All the annotations attached directly to the node
private var _n_cpar: nullable TCpar

nitc :: ASignature :: _n_cpar

The ) symbol
private var _n_opar: nullable TOpar

nitc :: ASignature :: _n_opar

The ( symbol
private var _n_params: ANodes[AParam]

nitc :: ASignature :: _n_params

The list of parameters
private var _n_type: nullable AType

nitc :: ASignature :: _n_type

The return type
private var _param_names: Array[String]

nitc :: ASignature :: _param_names

Names of parameters from the AST
private var _param_types: Array[MType]

nitc :: ASignature :: _param_types

Types of parameters from the AST
private var _parent: nullable ANode

nitc :: ANode :: _parent

Parent of the node in the AST
private var _ret_type: nullable MType

nitc :: ASignature :: _ret_type

Return type
private var _vararg_rank: Int

nitc :: ASignature :: _vararg_rank

Rank of the vararg (of -1 if none)
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 adapt_to_contract: ASignature

nitc :: ASignature :: adapt_to_contract

Create a new ASignature adapted for contract
private fun adapt_to_ensurecondition: ASignature

nitc :: ASignature :: adapt_to_ensurecondition

Create a new ASignature adapted for ensure
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.
private fun check_signature(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool

nitc :: ASignature :: check_signature

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 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 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 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 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_asignature(n_opar: nullable TOpar, n_params: Collection[Object], n_cpar: nullable TCpar, n_type: nullable AType)

nitc :: ASignature :: init_asignature

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_visited: Bool

nitc :: ASignature :: is_visited

Is the model builder has correctly visited the signature
protected fun is_visited=(is_visited: Bool)

nitc :: ASignature :: is_visited=

Is the model builder has correctly visited the signature
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 fun make_parameter_read(ast_builder: ASTBuilder): Array[AVarExpr]

nitc :: ASignature :: make_parameter_read

Create an array of AVarExpr representing the read of every parameters
protected fun make_tag(v: HtmlightVisitor): nullable HTMLTag

nitc :: ANode :: make_tag

Optionally creates a tag that encapsulate the AST element on HTML rendering
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_cpar: nullable TCpar

nitc :: ASignature :: n_cpar

The ) symbol
fun n_cpar=(n_cpar: nullable TCpar)

nitc :: ASignature :: n_cpar=

The ) symbol
fun n_opar: nullable TOpar

nitc :: ASignature :: n_opar

The ( symbol
fun n_opar=(n_opar: nullable TOpar)

nitc :: ASignature :: n_opar=

The ( symbol
fun n_params: ANodes[AParam]

nitc :: ASignature :: n_params

The list of parameters
protected fun n_params=(n_params: ANodes[AParam])

nitc :: ASignature :: n_params=

The list of parameters
fun n_type: nullable AType

nitc :: ASignature :: n_type

The return type
fun n_type=(n_type: nullable AType)

nitc :: ASignature :: n_type=

The return type
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 param_names: Array[String]

nitc :: ASignature :: param_names

Names of parameters from the AST
protected fun param_names=(param_names: Array[String])

nitc :: ASignature :: param_names=

Names of parameters from the AST
fun param_types: Array[MType]

nitc :: ASignature :: param_types

Types of parameters from the AST
protected fun param_types=(param_types: Array[MType])

nitc :: ASignature :: param_types=

Types of parameters from the AST
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 ret_type: nullable MType

nitc :: ASignature :: ret_type

Return type
protected fun ret_type=(ret_type: nullable MType)

nitc :: ASignature :: ret_type=

Return type
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.
fun vararg_rank: Int

nitc :: ASignature :: vararg_rank

Rank of the vararg (of -1 if none)
protected fun vararg_rank=(vararg_rank: Int)

nitc :: ASignature :: vararg_rank=

Rank of the vararg (of -1 if none)
abstract fun visit_all(v: Visitor)

nitc :: ANode :: visit_all

Visit all nodes in order.
private fun visit_signature(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool

nitc :: ASignature :: visit_signature

Visit and fill information about a signature
private abstract fun was_inline: Bool

nitc :: ANode :: was_inline

Does self was written in one line before transformation?
package_diagram nitc::ASignature ASignature nitc::Prod Prod nitc::ASignature->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 $ ASignature
# A signature in a method definition. eg `(x,y:X,z:Z):T`
class ASignature
	super Prod

	# The `(` symbol
	var n_opar: nullable TOpar = null is writable

	# The list of parameters
	var n_params = new ANodes[AParam](self)

	# The `)` symbol
	var n_cpar: nullable TCpar = null is writable

	# The return type
	var n_type: nullable AType = null is writable
end
src/parser/parser_nodes.nit:1779,1--1794,3

nitc :: parser_prod $ ASignature
redef class ASignature
	init init_asignature (
		n_opar: nullable TOpar,
		n_params: Collection[Object], # Should be Collection[AParam]
		n_cpar: nullable TCpar,
		n_type: nullable AType
	)
	do
		_n_opar = n_opar
		if n_opar != null then n_opar.parent = self
		self.n_params.unsafe_add_all(n_params)
		_n_cpar = n_cpar
		if n_cpar != null then n_cpar.parent = self
		_n_type = n_type
		if n_type != null then n_type.parent = self
	end

	redef fun replace_child(old_child: ANode, new_child: nullable ANode)
	do
		if _n_opar == old_child then
			n_opar = new_child.as(nullable TOpar)
			return
		end
		if n_params.replace_child(old_child, new_child) then return
		if _n_cpar == old_child then
			n_cpar = new_child.as(nullable TCpar)
			return
		end
		if _n_type == old_child then
			n_type = new_child.as(nullable AType)
			return
		end
	end

	redef fun n_opar=(node)
	do
		_n_opar = node
		if node != null then node.parent = self
	end
	redef fun n_cpar=(node)
	do
		_n_cpar = node
		if node != null then node.parent = self
	end
	redef fun n_type=(node)
	do
		_n_type = node
		if node != null then node.parent = self
	end


	redef fun visit_all(v: Visitor)
	do
		v.enter_visit(_n_opar)
		n_params.visit_all(v)
		v.enter_visit(_n_cpar)
		v.enter_visit(_n_type)
	end
end
src/parser/parser_prod.nit:2359,1--2417,3

nitc :: simple_misc_analysis $ ASignature
redef class ASignature
	redef fun after_simple_misc(v)
	do
		if self.n_opar != null and self.n_params.is_empty then
			v.warning(self, "parentheses", "Warning: superfluous parentheses.")
		end
	end
end
src/frontend/simple_misc_analysis.nit:96,1--103,3

nitc :: modelize_property $ ASignature
redef class ASignature
	# Is the model builder has correctly visited the signature
	var is_visited = false
	# Names of parameters from the AST
	# REQUIRE: is_visited
	var param_names = new Array[String]
	# Types of parameters from the AST
	# REQUIRE: is_visited
	var param_types = new Array[MType]
	# Rank of the vararg (of -1 if none)
	# REQUIRE: is_visited
	var vararg_rank: Int = -1
	# Return type
	var ret_type: nullable MType = null

	# Visit and fill information about a signature
	private fun visit_signature(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool
	do
		var param_names = self.param_names
		var param_types = self.param_types
		for np in self.n_params do
			param_names.add(np.n_id.text)
			var ntype = np.n_type
			if ntype != null then
				var mtype = modelbuilder.resolve_mtype_unchecked(mclassdef, ntype, true)
				if mtype == null then return false # Skip error
				for i in [0..param_names.length-param_types.length[ do
					param_types.add(mtype)
				end
				if np.n_dotdotdot != null then
					if self.vararg_rank != -1 then
						modelbuilder.error(np, "Error: `{param_names[self.vararg_rank]}` is already a vararg")
						return false
					else
						self.vararg_rank = param_names.length - 1
					end
				end
			end
		end
		var ntype = self.n_type
		if ntype != null then
			self.ret_type = modelbuilder.resolve_mtype_unchecked(mclassdef, ntype, true)
			if self.ret_type == null then return false # Skip error
		end

		self.is_visited = true
		return true
	end

	private fun check_signature(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool
	do
		var res = true
		for np in self.n_params do
			var ntype = np.n_type
			if ntype != null then
				if modelbuilder.resolve_mtype(mclassdef, ntype) == null then
					res = false
				end
			end
		end
		var ntype = self.n_type
		if ntype != null then
			if modelbuilder.resolve_mtype(mclassdef, ntype) == null then
				res = false
			end
		end
		if not res then is_broken = true
		return res
	end
end
src/modelize/modelize_property.nit:682,1--751,3

nitc :: pretty $ ASignature
redef class ASignature
	redef fun accept_pretty_printer(v) do
		if not n_params.is_empty then
			v.consume "("
			v.visit_list n_params
			v.consume ")"
		end

		if n_type != null then
			v.consume ":"
			v.adds
			v.visit n_type
		end
	end
end
src/pretty.nit:1025,1--1039,3

nitc :: astbuilder $ ASignature
redef class ASignature

	init make_from_msignature(msignature: MSignature)
	do
		var nparams = new Array[AParam]
		for mparam in msignature.mparameters do
			var variable = new Variable(mparam.name)
			variable.declared_type = mparam.mtype
			n_params.add(new AParam.make(variable, new AType.make(mparam.mtype)))
		end
		var return_type = null
		if msignature.return_mtype != null then return_type = new AType.make(msignature.return_mtype)
		init_asignature(null, nparams, null, return_type)
	end

	redef fun clone: SELF
	do
		var ntype = n_type
		if ntype != null then ntype = n_type.clone
		return new ASignature.init_asignature(null, n_params.clone, null, ntype)
	end
end
src/astbuilder.nit:736,1--757,3

nitc :: contracts $ ASignature
redef class ASignature

	# Create an array of AVarExpr representing the read of every parameters
	private fun make_parameter_read(ast_builder: ASTBuilder): Array[AVarExpr]
	do
		var args = new Array[AVarExpr]
		for n_param in self.n_params do
			var mtype = n_param.variable.declared_type
			var variable = n_param.variable
			if variable != null and mtype != null then
				args.push ast_builder.make_var_read(variable, mtype)
			end
		end
		return args
	end

	# Create a new ASignature adapted for contract
	#
	# The returned `ASignature` is the copy of `self` without return type.
	private fun adapt_to_contract: ASignature
	do
		var adapt_nsignature = self.clone
		if adapt_nsignature.n_type != null then adapt_nsignature.n_type.detach
		return adapt_nsignature
	end

	# Create a new ASignature adapted for ensure
	#
	# The returned `ASignature` is the copy of `self` without return type.
	# The return type is replaced by a new parameter `result`
	private fun adapt_to_ensurecondition: ASignature do
		var nsignature = adapt_to_contract
		if ret_type != null then
			var variable = new Variable("result")
			variable.declared_type = ret_type
			nsignature.n_params.add new AParam.make(variable, ret_type.create_ast_representation)
		end
		return nsignature
	end
end
src/contracts.nit:875,1--914,3

nitc :: test_astbuilder $ ASignature
redef class ASignature
	redef fun do_cloneable(v)
	do
		replace_clone
	end
end
src/test_astbuilder.nit:64,1--69,3