nitc :: MPropDef :: full_name=
classdef
and the mproperty
.Therefore the combination of identifiers is awful, the worst case being
Fortunately, the full-name is simplified when entities are repeated. For the previous case, the simplest form is "p$A$x".
# 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