end
end
-redef class MParameterType
- # The fully-qualified name of the formal parameter.
- fun full_name: String do return "{mclass.full_name}::{name}"
-end
-
# A specific analysis that detects the variance constraints of formal parameters.
#
# The client has 3 steps to do:
# The view of the module in the `model.mmodule_importation_hierarchy`
var in_importation: POSetElement[MModule] is noinit
- # The canonical name of the module
+ # The canonical name of the module.
+ #
+ # It is usually the `name` prefixed by the project's name.
# Example: `"project::name"`
- fun full_name: String
- do
+ #
+ # If both names are the same (of if the module is project-less), then
+ # the short-name is used alone.
+ redef var full_name is lazy do
var mgroup = self.mgroup
if mgroup == null or mgroup.mproject.name == self.name then
return self.name
redef var name: String
# 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"`
- fun full_name: String
- do
- return "{self.intro_mmodule.full_name}::{name}"
- end
+ redef var full_name is lazy do return "{self.intro_mmodule.full_name}::{name}"
# The number of generic formal parameters
# 0 if the class is not generic
# The (short) name of the property
redef var name: String
- # The canonical name of the property
- # Example: "owner::my_module::MyClass::my_method"
- fun full_name: String
- do
- return "{self.intro_mclassdef.mmodule.full_name}::{self.intro_mclassdef.mclass.name}::{name}"
+ # The canonical name of the property.
+ #
+ # It is the short-`name` prefixed by the short-name of the class and the full-name of the module.
+ # Example: "my_project::my_module::MyClass::my_method"
+ redef var full_name is lazy do
+ return "{intro_mclassdef.mmodule.full_name}::{intro_mclassdef.mclass.name}::{name}"
end
# The visibility of the property
# A named and possibly documented entity in the model.
# This class is useful to generalize presentation of entities to the human.
abstract class MEntity
- # The short (unqualified) name of this model entity
+ # The short (unqualified) name of this model entity.
+ #
+ # The short-name is based from the identifiers used to declare or denote the entity.
+ # It is usually globally ambiguous but is often enough in a precise local context.
+ #
+ # It is suitable to use the short-name in message to the user.
+ # However, special care must be used in case of potential ambiguities or name conflict.
fun name: String is abstract
+ # 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
+
# A Model Entity has a direct link to its model
fun model: Model is abstract
end
# see `in_nesting` for more
var parent: nullable MGroup
- # fully qualified name
- fun full_name: String
+ # Fully qualified name.
+ # It includes each parent group separated by `/`
+ redef fun full_name
do
var p = parent
if p == null then return name