nitc :: MVirtualType
nitc :: MVirtualType :: _api_url
nitc :: MVirtualType :: _mproperty
The property associated with the type.nitc :: MVirtualType :: _web_url
nitc :: MVirtualType :: api_url=
nitc :: MVirtualType :: defaultinit
nitc :: MVirtualType :: mproperty
The property associated with the type.nitc :: MVirtualType :: mproperty=
The property associated with the type.nitc :: MVirtualType :: web_url=
nitc $ MVirtualType :: SELF
Type of this instance, automatically specialized in every classnitc $ MVirtualType :: c_name
A fully-qualified C-like identifier of this model entity.nitc $ MVirtualType :: can_resolve_for
Can the type be resolved?nitc :: term_model $ MVirtualType :: cs_signature
Returnsself
signature formatted for console.
nitc $ MVirtualType :: full_name
A fully-qualified name of this model entity.nitc :: html_model $ MVirtualType :: html_link
Link to the MEntity in the HTML outputnitc :: htmlight $ MVirtualType :: infobox
An new infobox documenting the entitynitc :: htmlight $ MVirtualType :: linkto
A HTML version ofto_s
with hyper-links.
nitc $ MVirtualType :: lookup_bound
Resolve formal type to its verbatim bound.nitc $ MVirtualType :: lookup_fixed
A VT is fixed when:nitc $ MVirtualType :: mdoc_or_fallback
The documentation associated to the entity or their main nested entity.nitc $ MVirtualType :: resolve_for
Replace formals generic types in self with resolved values inmtype
nitc :: MVirtualType :: _api_url
nitc :: MFormalType :: _as_notnull
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 :: MVirtualType :: _mproperty
The property associated with the type.nitc :: MVirtualType :: _web_url
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 :: 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 :: MVirtualType :: api_url=
nitc :: MFormalType :: as_notnull=
nitc :: MType :: as_nullable_cache
nitc :: MType :: as_nullable_cache=
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 :: 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 :: MVirtualType :: defaultinit
nitc :: HInfoBoxable :: defaultinit
nitc :: NitniCallback :: defaultinit
core :: Object :: defaultinit
nitc :: MEntity :: defaultinit
nitc :: MFormalType :: defaultinit
nitc :: MType :: 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 :: MVirtualType :: mproperty
The property associated with the type.nitc :: MVirtualType :: mproperty=
The property associated with the type.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
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
v.enter_visit
on all nested entities.
nitc :: MVirtualType :: web_url=
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 virtual formal type.
class MVirtualType
super MFormalType
# The property associated with the type.
# Its the definitions of this property that determine the bound or the virtual type.
var mproperty: MVirtualTypeProp
redef fun location do return mproperty.location
redef fun model do return self.mproperty.intro_mclassdef.mmodule.model
redef fun lookup_bound(mmodule, resolved_receiver)
do
# There is two possible invalid cases: the vt does not exists in resolved_receiver or the bound is broken
if not resolved_receiver.has_mproperty(mmodule, mproperty) then return new MErrorType(model)
return lookup_single_definition(mmodule, resolved_receiver).bound or else new MErrorType(model)
end
private fun lookup_single_definition(mmodule: MModule, resolved_receiver: MType): MVirtualTypeDef
do
assert not resolved_receiver.need_anchor
var props = self.mproperty.lookup_definitions(mmodule, resolved_receiver)
if props.is_empty then
abort
else if props.length == 1 then
return props.first
end
var types = new ArraySet[MType]
var res = props.first
for p in props do
types.add(p.bound.as(not null))
if not res.is_fixed then res = p
end
if types.length == 1 then
return res
end
abort
end
# A VT is fixed when:
# * the VT is (re-)defined with the annotation `is fixed`
# * the receiver is an enum class since there is no subtype that can
# redefine this virtual type
redef fun lookup_fixed(mmodule: MModule, resolved_receiver: MType): MType
do
assert not resolved_receiver.need_anchor
resolved_receiver = resolved_receiver.undecorate
assert resolved_receiver isa MClassType # It is the only remaining type
var prop = lookup_single_definition(mmodule, resolved_receiver)
var res = prop.bound
if res == null then return new MErrorType(model)
# Recursively lookup the fixed result
res = res.lookup_fixed(mmodule, resolved_receiver)
# For a fixed VT, return the resolved bound
if prop.is_fixed then return res
# For a enum receiver return the bound
if resolved_receiver.mclass.kind == enum_kind then return res
return self
end
redef fun resolve_for(mtype, anchor, mmodule, cleanup_virtual)
do
if not cleanup_virtual then return self
assert can_resolve_for(mtype, anchor, mmodule)
if mproperty.is_selftype then return mtype
# self is a virtual type declared (or inherited) in mtype
# The point of the function it to get the bound of the virtual type that make sense for mtype
# But because mtype is maybe a virtual/formal type, we need to get a real receiver first
#print "{class_name}: {self}/{mtype}/{anchor}?"
var resolved_receiver
if mtype.need_anchor then
assert anchor != null
resolved_receiver = mtype.resolve_for(anchor, null, mmodule, true)
else
resolved_receiver = mtype
end
# Now, we can get the bound
var verbatim_bound = lookup_bound(mmodule, resolved_receiver)
# The bound is exactly as declared in the "type" property, so we must resolve it again
var res = verbatim_bound.resolve_for(mtype, anchor, mmodule, cleanup_virtual)
return res
end
redef fun can_resolve_for(mtype, anchor, mmodule)
do
if mtype.need_anchor then
assert anchor != null
mtype = mtype.anchor_to(mmodule, anchor)
end
return mtype.has_mproperty(mmodule, mproperty)
end
redef fun to_s do return self.mproperty.to_s
redef fun full_name do return self.mproperty.full_name
redef fun c_name do return self.mproperty.c_name
redef fun mdoc_or_fallback do return mproperty.mdoc_or_fallback
end
src/model/model.nit:1515,1--1623,3
redef class MVirtualType
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 "MVirtualType"
node.out_edges.add(new NeoEdge(node, "PROPERTY", mproperty.to_node(nodes, model_name)))
return node
end
end
src/neo.nit:903,1--911,3
redef class MVirtualType
redef fun cs_signature(no_color) do return name
end
src/doc/templates/term_model.nit:248,1--250,3
redef class MVirtualType
redef fun tpl_class(model) do
return name
end
end
src/uml/uml_class.nit:201,1--205,3
redef class MVirtualType
redef fun infobox(v)
do
var res = new HInfoBox(v, to_s)
res.href = v.hrefto(mproperty)
if not v.show_infobox then return res
var p = mproperty
res.new_field("virtual type").add p.intro.linkto(v)
add_doc_to_infobox(res)
return res
end
redef fun linkto(v)
do
return mproperty.intro.linkto(v)
end
end
src/htmlight.nit:590,1--605,3