# modules and module hierarchies in the metamodel
module mmodule
-import location
import mpackage
private import more_collections
# The short name of the module
redef var name: String
- # The origin of the definition
- var location: Location is writable
+ redef var location: Location is writable
# Alias for `name`
redef fun to_s do return self.name
# In Nit, the name of a class cannot evolve in refinements
redef var name
+ redef var location
+
# The canonical name of the class
#
# It is the name of the class prefixed by the full_name of the `intro_mmodule`
# ENSURE: `bound_mtype.mclass == self.mclass`
var bound_mtype: MClassType
- # The origin of the definition
- var location: Location
+ redef var location: Location
# Internal name combining the module and the class
# Example: "mymodule$MyClass"
# The associated global property
var mproperty: MPROPERTY
- # The origin of the definition
- var location: Location
+ redef var location: Location
init
do
# The abstract concept of model and related common things
module model_base
+import location
# The container class of a Nit object-oriented model.
# A model knows modules, classes and properties and can retrieve them.
super MEntity
redef fun model do return self
+
+ # Place-holder object that means no-location
+ #
+ # See `MEntity::location`
+ var no_location = new Location(null, 0, 0, 0, 0)
end
# A named and possibly documented entity in the model.
# indirect use should be restricted (e.g. to name a web-page)
fun c_name: String is abstract
+ # The origin of the definition.
+ #
+ # Most model entities are defined in a specific place in the source base.
+ #
+ # Because most model entities have one,
+ # it is simpler for the client to have a non-nullable return value.
+ # For entities that lack a location, mock-up special locations are used instead.
+ # By default it is `model.no_location`.
+ fun location: Location do return model.no_location
+
# A Model Entity has a direct link to its model
fun model: Model is abstract