The full-name is based on the short name and is usually prefixed by the name of an outer entity.
Usually the quad (::
) is used to separate the different names.
The full-name is expected to be unique and unambiguous in lawful Nit models for the same kind of entity.
It is often suitable to use it in message to the user. However, some full-name could be long and verbose,
See the specific implementation in subclasses for details.
# A fully-qualified name of this model entity.
#
# The full-name is based on the short name and is usually prefixed by the name of an outer entity.
# Usually the quad (`::`) is used to separate the different names.
#
# The full-name is expected to be unique and unambiguous in lawful Nit models for the same kind of entity.
#
# It is often suitable to use it in message to the user.
# However, some full-name could be long and verbose,
#
# See the specific implementation in subclasses for details.
fun full_name: String is abstract
src/model/model_base.nit:46,2--57,34
# The canonical name of the class
#
# It is the name of the class prefixed by the full_name of the `intro_mmodule`
# Example: `"owner::module::MyClass"`
redef var full_name is lazy do
return "{self.intro_mmodule.namespace_for(visibility)}::{name}"
end
src/model/model.nit:448,2--454,4
# The module and class name separated by a '$'.
#
# The short-name of the class is used for introduction.
# Example: "my_module$MyClass"
#
# The full-name of the class is used for refinement.
# Example: "my_module$intro_module::MyClass"
redef var full_name is lazy do
if is_intro then
# public gives 'p$A'
# private gives 'p::m$A'
return "{mmodule.namespace_for(mclass.visibility)}${mclass.name}"
else if mclass.intro_mmodule.mpackage != mmodule.mpackage then
# public gives 'q::n$p::A'
# private gives 'q::n$p::m::A'
return "{mmodule.full_name}${mclass.full_name}"
else if mclass.visibility > private_visibility then
# public gives 'p::n$A'
return "{mmodule.full_name}${mclass.name}"
else
# private gives 'p::n$::m::A' (redundant p is omitted)
return "{mmodule.full_name}$::{mclass.intro_mmodule.name}::{mclass.name}"
end
end
src/model/model.nit:684,2--707,4
# Fully qualified name.
# It includes each parent group separated by `>`.
# The full_name is terminated by `>` to avoid collision with other entities.
#
# E.g. `core>` and `core>collection>`
redef fun full_name
do
var p = parent
if p == null then return "{name}>"
return "{p.full_name}{name}>"
end
src/model/mpackage.nit:132,2--142,4
# The canonical name of the property.
#
# It is currently the short-`name` prefixed by the short-name of the class and the full-name of the module.
# Example: "my_package::my_module::MyClass::my_method"
#
# The full-name of the module is needed because two distinct modules of the same package can
# still refine the same class and introduce homonym properties.
#
# For public properties not introduced by refinement, the module name is not used.
#
# Example: `my_package::MyClass::My_method`
redef var full_name is lazy do
if intro_mclassdef.is_intro then
return "{intro_mclassdef.mmodule.namespace_for(visibility)}::{intro_mclassdef.mclass.name}::{name}"
else
return "{intro_mclassdef.mmodule.full_name}::{intro_mclassdef.mclass.name}::{name}"
end
end
src/model/model.nit:2166,2--2183,4
# The full-name of mpropdefs combine the information about the `classdef` and the `mproperty`.
#
# Therefore the combination of identifiers is awful,
# the worst case being
#
# * a property "p::m::A::x"
# * redefined in a refinement of a class "q::n::B"
# * in a module "r::o"
# * so "r::o$q::n::B$p::m::A::x"
#
# Fortunately, the full-name is simplified when entities are repeated.
# For the previous case, the simplest form is "p$A$x".
redef var full_name is lazy do
var res = new FlatBuffer
# The first part is the mclassdef. Worst case is "r::o$q::n::B"
res.append mclassdef.full_name
res.append "$"
if mclassdef.mclass == mproperty.intro_mclassdef.mclass then
# intro are unambiguous in a class
res.append name
else
# Just try to simplify each part
if mclassdef.mmodule.mpackage != mproperty.intro_mclassdef.mmodule.mpackage then
# precise "p::m" only if "p" != "r"
res.append mproperty.intro_mclassdef.mmodule.namespace_for(mproperty.visibility)
res.append "::"
else if mproperty.visibility <= private_visibility then
# Same package ("p"=="q"), but private visibility,
# does the module part ("::m") need to be displayed
if mclassdef.mmodule.namespace_for(mclassdef.mclass.visibility) != mproperty.intro_mclassdef.mmodule.mpackage then
res.append "::"
res.append mproperty.intro_mclassdef.mmodule.name
res.append "::"
end
end
# precise "B" because it is not the same class than "A"
res.append mproperty.intro_mclassdef.name
res.append "::"
# Always use the property name "x"
res.append mproperty.name
end
return res.to_s
end
src/model/model.nit:2543,2--2588,4
# The canonical name of the module.
#
# It is usually the `name` prefixed by the package's name.
# Example: `"package::name"`
#
# Default modules use a doubled name to distinguish them from the package name.
# E.g.: `"core::core"`
#
# If the module is package-less, then the short-name is used alone.
redef var full_name is lazy do
var mgroup = self.mgroup
if mgroup == null then
return self.name
else
return "{mgroup.mpackage.name}::{self.name}"
end
end
src/model/mmodule.nit:111,2--127,4
# The full-name of the class, then the full-name of each type arguments within brackets.
# Example: `"core::Map[core::String, core::List[core::Int]]"`
redef var full_name is lazy do
var args = new Array[String]
for t in arguments do
args.add t.full_name
end
return "{mclass.full_name}[{args.join(", ")}]"
end
src/model/model.nit:1424,2--1432,4