nitc :: MSignature
nitc :: MSignature :: _mparameters
The each parameter (in order)nitc :: MSignature :: _return_mtype
The return type (null for a procedure)nitc :: MSignature :: _vararg_rank
The rank of the main ellipsis (...
) for vararg (starting from 0).
nitc :: MSignature :: adapt_to_contract
Adapt signature for an contractnitc :: MSignature :: adapt_to_ensurecondition
Adapt signature for a ensure contractnitc :: MSignature :: c_equiv
Does the C-version ofself
the same than the C-version of other
?
nitc :: MSignature :: clone
The returnedMSignature
is the exact copy of self
.
nitc :: MSignature :: defaultinit
nitc :: MSignature :: mparameter_by_name
Returns a parameter namedname
, if any.
nitc :: MSignature :: mparameters=
The each parameter (in order)nitc :: MSignature :: return_mtype
The return type (null for a procedure)nitc :: MSignature :: return_mtype=
The return type (null for a procedure)nitc :: MSignature :: vararg_rank
The rank of the main ellipsis (...
) for vararg (starting from 0).
nitc :: MSignature :: vararg_rank=
The rank of the main ellipsis (...
) for vararg (starting from 0).
nitc $ MSignature :: SELF
Type of this instance, automatically specialized in every classnitc :: json_model $ MSignature :: core_serialize_to
Actual serialization ofself
to serializer
nitc :: astbuilder $ MSignature :: create_ast_representation
Build a ANode fromself
nitc :: term_model $ MSignature :: cs_signature
Returnsself
signature formatted for console.
nitc :: html_model $ MSignature :: html_signature
Returns the MEntity signature decorated with HTMLnitc :: htmlight $ MSignature :: linkto
A HTML version ofto_s
with hyper-links.
nitc $ MSignature :: resolve_for
Replace formals generic types in self with resolved values inmtype
nitc :: MType :: _as_nullable_cache
nitc :: MEntity :: _const_color
nitc :: MEntity :: _css_classes
CSS classes used to decorateself
nitc :: MEntity :: _deprecation
Is the entity deprecated?nitc :: MEntity :: _html_full_name
The MEntityfull_name
escaped for HTML
nitc :: MEntity :: _is_broken
The indication that the entity did not pass some semantic verifications.nitc :: MType :: _is_java_primitive
Is the associated Java type a primitive one?nitc :: MSignature :: _mparameters
The each parameter (in order)nitc :: MSignature :: _return_mtype
The return type (null for a procedure)nitc :: MSignature :: _vararg_rank
The rank of the main ellipsis (...
) for vararg (starting from 0).
serialization :: Serializable :: accept_inspect_serializer_core
serialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePacknitc :: MSignature :: adapt_to_contract
Adapt signature for an contractnitc :: MSignature :: adapt_to_ensurecondition
Adapt signature for a ensure contractnitc :: MEntity :: add_doc_to_infobox
Append an entry for the doc in the given infoboxserialization :: Serializable :: add_to_bundle
Called by[]=
to dynamically choose the appropriate method according
nitc :: MType :: as_nullable_cache
nitc :: MType :: as_nullable_cache=
nitc :: MSignature :: c_equiv
Does the C-version ofself
the same than the C-version of other
?
nitc :: MType :: call_arg_field
Field to store this type in the C structurenit_call_arg
nitc :: MType :: can_resolve_for
Can the type be resolved?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: MSignature :: clone
The returnedMSignature
is the exact copy of self
.
nitc :: MType :: cname_blind
Representation of this type in C for the internal of the systemnitc :: MType :: cname_normal_class
Name of this type in C for normal classes (not extern and not primitive)nitc :: MEntity :: collect_ancestors
Collectself
ancestors (direct and indirect)
nitc :: MEntity :: collect_children
Collectself
children (direct descendants)
nitc :: MEntity :: collect_descendants
Collectself
descendants (direct and direct)
nitc :: MEntity :: collect_linearization
Collectself
linearization anchored on mainmodule
nitc :: MType :: collect_mclassdefs
Compute all the classdefs inherited/imported.nitc :: MType :: collect_mclasses
Compute all the super-classes.nitc :: MEntity :: collect_metrics
nitc :: MEntity :: collect_modifiers
Collect modifier keywords likeredef
, private
etc
nitc :: MType :: collect_mtypes
Compute all the declared super-types.nitc :: MEntity :: collect_parents
Collectself
parents (direct ancestors)
nitc :: NitniCallback :: compile_callback_to_java
Compile C and Java code to implement this callbacknitc :: NitniCallback :: compile_callback_to_objc
Compile this callback to be callable from Objective-Cnitc :: MType :: compile_extern_type
nitc :: MEntity :: const_color
nitc :: MEntity :: const_color=
nitc :: MEntity :: core_serialize_base
serialization :: Serializable :: core_serialize_to
Actual serialization ofself
to serializer
nitc :: MEntity :: create_ast_representation
Build a ANode fromself
nitc :: MEntity :: cs_comment
Returns the comment of this MEntity formatted for console.nitc :: MEntity :: cs_declaration
Returns the complete MEntity declaration (modifiers + name + signature).nitc :: MEntity :: cs_full_name
Returnsself.full_name
formatted for console
nitc :: MEntity :: cs_list_item
Returnsself
as a list element that can be displayed in console.
nitc :: MEntity :: cs_location
Source code location of this MEntity formatted for consolenitc :: MEntity :: cs_short_comment
Returns the comment of this MEntity formatted for console.nitc :: MEntity :: cs_signature
Returnsself
signature formatted for console.
nitc :: MEntity :: cs_source_code
Source code associated to this MEntity.nitc :: MEntity :: css_classes=
CSS classes used to decorateself
nitc :: MType :: ctype_extern
C type outside of the compiler code and in boxesnitc :: MType :: defaultinit
nitc :: HInfoBoxable :: defaultinit
core :: Object :: defaultinit
nitc :: MEntity :: defaultinit
nitc :: NitniCallback :: defaultinit
nitc :: MSignature :: defaultinit
nitc :: MEntity :: deprecation=
Is the entity deprecated?nitc :: MEntity :: field_separator
serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
nitc :: MType :: gen_arg_convert
Write code intemplate
to parse the argument arg_name
to this parameter type
nitc :: MType :: has_mproperty
Is the property in self for a given modulenitc :: MEntity :: hierarchy_poset
Build a poset representingself
in it's own hierarchy
nitc :: MEntity :: html_declaration
Returns the complete MEntity declaration decorated with HTMLnitc :: MEntity :: html_full_name=
The MEntityfull_name
escaped for HTML
nitc :: MEntity :: html_name=
The MEntity name escaped for HTMLnitc :: MEntity :: html_namespace
Returnsfull_name
decorated with HTML links
nitc :: MEntity :: html_signature
Returns the MEntity signature decorated with HTMLnitc :: HInfoBoxable :: infobox
An new infobox documenting the entitynitc :: MEntity :: is_broken=
The indication that the entity did not pass some semantic verifications.nitc :: MType :: is_cprimitive
Does this type have a primitive representation?nitc :: MEntity :: is_fictive=
Isself
created for internal purpose?
nitc :: MType :: is_java_primitive
Is the associated Java type a primitive one?nitc :: MType :: is_java_primitive=
Is the associated Java type a primitive one?nitc :: MType :: is_legal_in
Is the type legal in a givenmmodule
(with an optional anchor
)?
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 :: MType :: is_subtype
Return true ifself
is an subtype of sup
.
nitc :: MType :: is_subtype_invar
Return true ifself
is a invariant subtype of sup
.
nitc :: MType :: java_is_nit_object
Is this type opaque in Java? As so it is represented bynit.app.NitObject
.
nitc :: NitniCallback :: jni_methods_declaration
Returns the list of C functions to link with extern Java methods, as requirednitc :: MType :: jni_signature_alt
Type name appearing within JNI function names.nitc :: MEntity :: json_namespace
Returnself.full_name
as an object that can be serialized to json.
nitc :: MEntity :: line_separator
nitc :: MEntity :: linkto_text
Link to theself
with a specific text.
nitc :: MType :: lookup_bound
Resolve formal type to its verbatim bound.nitc :: MType :: lookup_fixed
Resolve the formal type to its simplest equivalent form.nitc :: MType :: mangled_cname
Representation of this type in mangled Cnitc :: MEntity :: mdoc_or_fallback
The documentation associated to the entity or their main nested entity.nitc :: MSignature :: mparameter_by_name
Returns a parameter namedname
, if any.
nitc :: MSignature :: mparameters=
The each parameter (in order)serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: Object :: native_class_name
The class name of the object in CString format.nitc :: MType :: need_anchor
Doesself
contain a virtual type or a formal generic parameter type?
nitc :: MType :: needs_type_check
Does this parameter type needs to be checked before calling the method?core :: Object :: output_class_name
Display class name on stdout (debug only).mentity
nitc :: MEntity :: ratings_by_dimension
Get the ratings of adimension
nitc :: MType :: resolve_for
Replace formals generic types in self with resolved values inmtype
nitc :: MSignature :: return_mtype
The return type (null for a procedure)nitc :: MSignature :: return_mtype=
The return type (null for a procedure)serialization :: Serializable :: serialize_msgpack
Serializeself
to MessagePack bytes
serialization :: Serializable :: serialize_to
Serializeself
to serializer
serialization :: Serializable :: serialize_to_json
Serializeself
to JSON
serialization :: Serializable :: serialize_to_or_delay
Accept references or force direct serialization (usingserialize_to
)
nitc :: MType :: signature_depth
nitc :: MEntity :: source_url
Render a HTML link for the MEntity locationnitc :: MType :: supertype_to
Return the supertype when adapted to a class.serialization :: Serializable :: to_pretty_json
Serializeself
to plain pretty JSON
nitc :: MEntity :: tpl_module
Builds a dot UML package diagram entity fromself
nitc :: MSignature :: vararg_rank
The rank of the main ellipsis (...
) for vararg (starting from 0).
nitc :: MSignature :: vararg_rank=
The rank of the main ellipsis (...
) for vararg (starting from 0).
v.enter_visit
on all nested entities.
nitc :: MEntity :: write_extra_doc
Extra auto documentation to append to thestream
nitc :: MEntity :: write_location
Location (file and line when available) of related declarations
# A signature of a method
class MSignature
super MType
# The each parameter (in order)
var mparameters: Array[MParameter]
# Returns a parameter named `name`, if any.
fun mparameter_by_name(name: String): nullable MParameter
do
for p in mparameters do
if p.name == name then return p
end
return null
end
# The return type (null for a procedure)
var return_mtype: nullable MType
redef fun depth
do
var dmax = 0
var t = self.return_mtype
if t != null then dmax = t.depth
for p in mparameters do
var d = p.mtype.depth
if d > dmax then dmax = d
end
return dmax + 1
end
redef fun length
do
var res = 1
var t = self.return_mtype
if t != null then res += t.length
for p in mparameters do
res += p.mtype.length
end
return res
end
# REQUIRE: 1 <= mparameters.count p -> p.is_vararg
init
do
var vararg_rank = -1
for i in [0..mparameters.length[ do
var parameter = mparameters[i]
if parameter.is_vararg then
if vararg_rank >= 0 then
# If there is more than one vararg,
# consider that additional arguments cannot be mapped.
vararg_rank = -1
break
end
vararg_rank = i
end
end
self.vararg_rank = vararg_rank
end
# The rank of the main ellipsis (`...`) for vararg (starting from 0).
# value is -1 if there is no vararg.
# Example: for "(a: Int, b: Bool..., c: Char)" #-> vararg_rank=1
#
# From a model POV, a signature can contain more than one vararg parameter,
# the `vararg_rank` just indicates the one that will receive the additional arguments.
# However, currently, if there is more that one vararg parameter, no one will be the main one,
# and additional arguments will be refused.
var vararg_rank: Int is noinit
# The number of parameters
fun arity: Int do return mparameters.length
redef fun to_s
do
var b = new FlatBuffer
if not mparameters.is_empty then
b.append("(")
var last_mtype = null
for i in [0..mparameters.length[ do
var mparameter = mparameters[i]
# Group types that are common to contiguous parameters
if mparameter.mtype != last_mtype and last_mtype != null then
b.append(": ")
b.append(last_mtype.to_s)
end
if i > 0 then b.append(", ")
b.append(mparameter.name)
if mparameter.is_vararg then
b.append(": ")
b.append(mparameter.mtype.to_s)
b.append("...")
last_mtype = null
else
last_mtype = mparameter.mtype
end
end
if last_mtype != null then
b.append(": ")
b.append(last_mtype.to_s)
end
b.append(")")
end
var ret = self.return_mtype
if ret != null then
b.append(": ")
b.append(ret.to_s)
end
return b.to_s
end
redef fun resolve_for(mtype: MType, anchor: nullable MClassType, mmodule: MModule, cleanup_virtual: Bool): MSignature
do
var params = new Array[MParameter]
for p in self.mparameters do
params.add(p.resolve_for(mtype, anchor, mmodule, cleanup_virtual))
end
var ret = self.return_mtype
if ret != null then
ret = ret.resolve_for(mtype, anchor, mmodule, cleanup_virtual)
end
var res = new MSignature(params, ret)
return res
end
end
src/model/model.nit:1964,1--2094,3
redef class MSignature
redef fun to_node(nodes: HashMap[MEntity, NeoNode], model_name: nullable String): NeoNode do
if nodes.has_key(self) then return nodes[self]
var node = super
node.labels.add "MSignature"
var names = new JsonArray
var rank = 0
for mparameter in mparameters do
names.add mparameter.name
var pnode = mparameter.to_node(nodes, model_name)
pnode["rank"] = rank
node.out_edges.add(new NeoEdge(node, "PARAMETER", pnode))
rank += 1
end
if not names.is_empty then node["parameter_names"] = names
var return_mtype = return_mtype
if return_mtype != null then
node.out_edges.add(new NeoEdge(node, "RETURNTYPE", return_mtype.to_node(nodes, model_name)))
end
return node
end
end
src/neo.nit:934,1--955,3
redef class MSignature
redef fun create_ast_representation(astbuilder: nullable ASTBuilder): ASignature do
var nparams = new Array[AParam]
for mparam in mparameters do nparams.add(mparam.create_ast_representation(astbuilder))
var return_type = null
if self.return_mtype != null then return_type = self.return_mtype.create_ast_representation(astbuilder)
return new ASignature.init_asignature(null, nparams, null, return_type)
end
end
src/astbuilder.nit:1018,1--1026,3
redef class MSignature
redef fun cs_signature(no_color) do
var tpl = new FlatBuffer
if not mparameters.is_empty then
tpl.append "("
for i in [0..mparameters.length[ do
tpl.append mparameters[i].cs_signature(no_color)
if i < mparameters.length - 1 then tpl.append ", "
end
tpl.append ")"
end
var return_mtype = self.return_mtype
if return_mtype != null then
tpl.append ": "
tpl.append return_mtype.cs_signature(no_color)
end
return tpl.write_to_string
end
end
src/doc/templates/term_model.nit:252,1--270,3
redef class MSignature
redef fun tpl_class(model) do
var t = new Template
t.add "("
var params = new Array[MParameter]
for i in mparameters do
params.add i
end
if params.length > 0 then
t.add params.first.name.escape_to_dot
t.add ": "
t.add params.first.mtype.tpl_class(model)
for i in [1 .. params.length [ do
t.add ", "
t.add params[i].name.escape_to_dot
t.add ": "
t.add params[i].mtype.tpl_class(model)
end
end
t.add ")"
if return_mtype != null then
t.add ": "
t.add return_mtype.tpl_class(model)
end
return t
end
end
src/uml/uml_class.nit:115,1--142,3
redef class MSignature
# Adapt signature for an contract
#
# The returned `MSignature` is the copy of `self` without return type.
private fun adapt_to_contract: MSignature do return new MSignature(mparameters.to_a, null)
# Adapt signature for a ensure contract
#
# The returned `MSignature` is the copy of `self` without return type.
# The return type is replaced by a new parameter `result`
private fun adapt_to_ensurecondition: MSignature
do
var rtype = return_mtype
var msignature = adapt_to_contract
if rtype != null then
msignature.mparameters.add(new MParameter("result", rtype, false))
end
return msignature
end
# The returned `MSignature` is the exact copy of `self`.
private fun clone: MSignature do return new MSignature(mparameters.to_a, return_mtype)
end
src/contracts.nit:767,1--790,3
redef class MSignature
redef fun linkto(v)
do
var res = new HTMLTag("span")
var first = true
if not mparameters.is_empty then
res.append "("
for p in mparameters do
if first then
first = false
else
res.append ", "
end
res.append p.name
res.append ": "
res.add p.mtype.linkto(v)
end
res.append ")"
end
var ret = return_mtype
if ret != null then
res.append ": "
res.add ret.linkto(v)
end
return res
end
end
src/htmlight.nit:656,1--682,3
redef class MSignature
redef fun html_signature(short) do
var tpl = new Template
if not mparameters.is_empty then
tpl.add "("
for i in [0..mparameters.length[ do
tpl.add mparameters[i].html_signature(short)
if i < mparameters.length - 1 then tpl.add ", "
end
tpl.add ")"
end
if short == null or not short then
var return_mtype = self.return_mtype
if return_mtype != null then
tpl.add ": "
tpl.add return_mtype.html_signature(short)
end
end
return tpl
end
end
src/doc/templates/html_model.nit:319,1--339,3
redef class MSignature
# Does the C-version of `self` the same than the C-version of `other`?
fun c_equiv(other: MSignature): Bool
do
if self == other then return true
if arity != other.arity then return false
for i in [0..arity[ do
if mparameters[i].mtype.ctype != other.mparameters[i].mtype.ctype then return false
end
if return_mtype != other.return_mtype then
if return_mtype == null or other.return_mtype == null then return false
if return_mtype.ctype != other.return_mtype.ctype then return false
end
return true
end
end
src/compiler/separate_compiler.nit:2446,1--2461,3
redef class MSignature
redef fun core_serialize_to(v) do
v.serialize_attribute("arity", arity)
v.serialize_attribute("mparameters", mparameters)
v.serialize_attribute("return_mtype", return_mtype)
end
end
src/doc/templates/json_model.nit:317,1--323,3