model: add `MEntity` as a superclass for model entities (ie. most classes in model)
authorJean Privat <jean@pryen.org>
Wed, 19 Mar 2014 18:50:33 +0000 (14:50 -0400)
committerJean Privat <jean@pryen.org>
Wed, 19 Mar 2014 18:50:33 +0000 (14:50 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/model/mmodule.nit
src/model/model.nit
src/model/model_base.nit
src/model/mproject.nit

index d2750ed..60a7c92 100644 (file)
@@ -69,6 +69,8 @@ end
 
 # A Nit module is usually associated with a Nit source file.
 class MModule
+       super MEntity
+
        # The model considered
        var model: Model
 
index ad1c325..7af7656 100644 (file)
@@ -287,6 +287,8 @@ end
 # belong to a hierarchy since the property and the
 # hierarchy of a class depends of a module.
 class MClass
+       super MEntity
+
        # The module that introduce the class
        # While classes are not bound to a specific module,
        # the introducing module is used for naming an visibility
@@ -412,6 +414,8 @@ end
 # class. Unlike `MClass`, a `MClassDef` is a local definition that belong to
 # a specific module
 class MClassDef
+       super MEntity
+
        # The module where the definition is
        var mmodule: MModule
 
@@ -542,6 +546,7 @@ end
 #  * foo(anchor, mmodule, othertype)
 #  * foo(othertype, mmodule, anchor)
 abstract class MType
+       super MEntity
 
        # The model of the type
        fun model: Model is abstract
@@ -1482,6 +1487,8 @@ end
 # of any dynamic type).
 # For instance, a call site "x.foo" is associated to a `MProperty`.
 abstract class MProperty
+       super MEntity
+
        # The associated MPropDef subclass.
        # The two specialization hierarchy are symmetric.
        type MPROPDEF: MPropDef
@@ -1745,6 +1752,7 @@ end
 # Unlike `MProperty`, a `MPropDef` is a local definition that belong to a
 # specific class definition (which belong to a specific module)
 abstract class MPropDef
+       super MEntity
 
        # The associated `MProperty` subclass.
        # the two specialization hierarchy are symmetric
index dda72bb..409b66b 100644 (file)
@@ -22,6 +22,11 @@ module model_base
 class Model
 end
 
+# A named and possibly documented entity in the model.
+# This class is usefull to generalize presentation of entities to the human.
+abstract class MEntity
+end
+
 # A visibility (for modules, class and properties)
 # Valid visibility are:
 #
index 9c1765f..cad2e39 100644 (file)
@@ -21,6 +21,8 @@ import poset
 
 # A Nit project, thas encompass a product
 class MProject
+       super MEntity
+
        # The name of the project
        var name: String
 
@@ -46,6 +48,8 @@ end
 
 # A group of modules in a project
 class MGroup
+       super MEntity
+
        # The name of the group
        # empty name for a default group in a single-module project
        var name: String