nitc :: ASignature
(x,y:X,z:Z):T
nitc :: ASignature :: _is_visited
Is the model builder has correctly visited the signaturenitc :: ASignature :: _param_names
Names of parameters from the ASTnitc :: ASignature :: _param_types
Types of parameters from the ASTnitc :: ASignature :: adapt_to_contract
Create a new ASignature adapted for contractnitc :: ASignature :: adapt_to_ensurecondition
Create a new ASignature adapted for ensurenitc :: ASignature :: check_signature
nitc :: ASignature :: defaultinit
nitc :: ASignature :: init_asignature
nitc :: ASignature :: is_visited
Is the model builder has correctly visited the signaturenitc :: ASignature :: is_visited=
Is the model builder has correctly visited the signaturenitc :: ASignature :: make_parameter_read
Create an array of AVarExpr representing the read of every parametersnitc :: ASignature :: param_names=
Names of parameters from the ASTnitc :: ASignature :: param_types=
Types of parameters from the ASTnitc :: ASignature :: vararg_rank=
Rank of the vararg (of -1 if none)nitc :: ASignature :: visit_signature
Visit and fill information about a signaturenitc $ ASignature :: SELF
Type of this instance, automatically specialized in every classnitc :: pretty $ ASignature :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: simple_misc_analysis $ ASignature :: after_simple_misc
nitc :: test_astbuilder $ ASignature :: do_cloneable
nitc :: parser_prod $ ASignature :: replace_child
Replace a child with an other node in the ASTnitc :: parser_prod $ ASignature :: visit_all
Visit all nodes in order.nitc :: Prod :: _first_location
Location on the first token after the start of a productionnitc :: Prod :: _first_token
The first token of the production in the ASTnitc :: ANode :: _is_broken
The indication that the node did not pass some semantic verifications.nitc :: ASignature :: _is_visited
Is the model builder has correctly visited the signaturenitc :: Prod :: _last_token
The last token of the production in the ASTnitc :: Prod :: _n_annotations
All the annotations attached directly to the nodenitc :: ASignature :: _param_names
Names of parameters from the ASTnitc :: ASignature :: _param_types
Types of parameters from the ASTnitc :: ANode :: accept_ast_validation
nitc :: ANode :: accept_auto_super_init
nitc :: ANode :: accept_flow_visitor
nitc :: ANode :: accept_forward_analysis
Apply the forward analysisv
to self
.
nitc :: ANode :: accept_literal
nitc :: ANode :: accept_post_typing
nitc :: ANode :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: ANode :: accept_reaching_defs
Apply a ReachingDefsAnalysis toself
.
nitc :: ANode :: accept_regex_visitor
nitc :: ANode :: accept_scope_visitor
nitc :: ANode :: accept_simple_misc
nitc :: ANode :: accept_string_finder
nitc :: ASignature :: adapt_to_contract
Create a new ASignature adapted for contractnitc :: ASignature :: adapt_to_ensurecondition
Create a new ASignature adapted for ensurenitc :: ANode :: after_simple_misc
nitc :: ANode :: bad_expr_message
An additional information message to explain the role of a child expression.nitc :: ANode :: check_callsite
nitc :: ASignature :: check_signature
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: ANode :: collect_annotations_by_name
Do a deep search and return an array of node that are annotatednitc :: Prod :: collect_comments
Collect allTComment
contained in the production
nitc :: ANode :: collect_length
Collect the length (inChar
) of the node.
nitc :: ANode :: collect_tokens_by_text
Do a deep search and return an array of tokens that match a given textnitc :: ANode :: common_parent
The most specific common parent betweenself
and other
nitc :: ANode :: create_contracts
nitc :: ANode :: decorate_tag
Add aditionnal information on a child-token and return an additionnal HInfoBox on itnitc :: ANode :: defaultinit
core :: Object :: defaultinit
nitc :: Prod :: defaultinit
core :: Cloneable :: defaultinit
nitc :: ASignature :: defaultinit
nitc :: ANode :: do_cloneable
nitc :: Prod :: first_location
Location on the first token after the start of a productionnitc :: Prod :: first_location=
Location on the first token after the start of a productionnitc :: Prod :: first_token
The first token of the production in the ASTnitc :: Prod :: first_token=
The first token of the production in the ASTnitc :: ANode :: force_block=
Forceself
to be rendered as a block.
nitc :: ANode :: force_inline=
Forceself
to be rendered as a line.
nitc :: ANode :: full_transform_visitor
nitc :: Prod :: get_annotations
Return all its annotations of a given name in the order of their declarationnitc :: Prod :: get_single_annotation
Try to get its single annotation with a given namenitc :: ANode :: hot_location
The location of the important part of the node (identifier or whatever)nitc :: ASignature :: init_asignature
nitc :: ANode :: is_broken=
The indication that the node did not pass some semantic verifications.nitc :: ANode :: is_noserialize
Is this node annotated to not be made serializable?core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: ANode :: is_serialize
Is this node annotated to be made serializable?nitc :: ANode :: is_structural
Isself
a token or a pure-structural production like AQId
?
nitc :: ASignature :: is_visited
Is the model builder has correctly visited the signaturenitc :: ASignature :: is_visited=
Is the model builder has correctly visited the signaturenitc :: Prod :: last_token
The last token of the production in the ASTnitc :: Prod :: last_token=
The last token of the production in the ASTnitc :: ASignature :: make_parameter_read
Create an array of AVarExpr representing the read of every parametersnitc :: ANode :: must_be_block
Doesself
have to be rendered as a block?
nitc :: ANode :: must_be_inline
Doesself
have be rendered as a line?
nitc :: Prod :: n_annotations
All the annotations attached directly to the nodenitc :: Prod :: n_annotations=
All the annotations attached directly to the nodecore :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: ASignature :: param_names=
Names of parameters from the ASTnitc :: ASignature :: param_types=
Types of parameters from the ASTnitc :: ANode :: parentize_tokens
Visit the AST and computes advanced AST attributes on Tokens and Prodnitc :: ANode :: replace_child
Replace a child with an other node in the ASTnitc :: ANode :: replace_with
Replace itself with an other node in the ASTnitc :: Prod :: start_token
The token where the production really start (skipping ADoc).nitc :: ASignature :: vararg_rank=
Rank of the vararg (of -1 if none)nitc :: ASignature :: visit_signature
Visit and fill information about a signaturenitc :: ANode :: was_inline
Doesself
was written in one line before transformation?
# 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
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
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
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
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
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
redef class ASignature
redef fun do_cloneable(v)
do
replace_clone
end
end
src/test_astbuilder.nit:64,1--69,3