model: introduce `name` in MEntity according to it's documentation
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 25 Jun 2014 21:32:34 +0000 (17:32 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Wed, 25 Jun 2014 21:32:34 +0000 (17:32 -0400)
Documentation was:
 # A named and possibly documented entity in the model.
So I added the name...

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

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

index 60a7c92..37c3ed0 100644 (file)
@@ -84,7 +84,7 @@ class MModule
        var mgroup: nullable MGroup
 
        # The short name of the module
-       var name: String
+       redef var name: String
 
        # The origin of the definition
        var location: Location
index 6732a16..1094c63 100644 (file)
@@ -302,7 +302,7 @@ class MClass
 
        # The short name of the class
        # In Nit, the name of a class cannot evolve in refinements
-       var name: String
+       redef var name: String
 
        # The canonical name of the class
        # Example: `"owner::module::MyClass"`
@@ -463,6 +463,9 @@ class MClassDef
                self.to_s = "{mmodule}#{mclass}"
        end
 
+       # Actually the name of the `mclass`
+       redef fun name do return mclass.name
+
        # All declared super-types
        # FIXME: quite ugly but not better idea yet
        var supertypes: Array[MClassType] = new Array[MClassType]
@@ -1514,7 +1517,7 @@ abstract class MProperty
        var intro_mclassdef: MClassDef
 
        # The (short) name of the property
-       var name: String
+       redef var name: String
 
        # The canonical name of the property
        # Example: "owner::my_module::MyClass::my_method"
@@ -1799,6 +1802,9 @@ abstract class MPropDef
                self.to_s = "{mclassdef}#{mproperty}"
        end
 
+       # Actually the name of the `mproperty`
+       redef fun name do return mproperty.name
+
        # Internal name combining the module, the class and the property
        # Example: "mymodule#MyClass#mymethod"
        redef var to_s: String
index 39df50b..a51ec29 100644 (file)
@@ -25,6 +25,8 @@ 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
+       # The short (unqualified) name of this model entity
+       fun name: String is abstract
 end
 
 # A visibility (for modules, class and properties)
index cad2e39..4208008 100644 (file)
@@ -24,7 +24,7 @@ class MProject
        super MEntity
 
        # The name of the project
-       var name: String
+       redef var name: String
 
        # The model of the project
        var model: Model
@@ -52,7 +52,7 @@ class MGroup
 
        # The name of the group
        # empty name for a default group in a single-module project
-       var name: String
+       redef var name: String
 
        # The englobing project
        var mproject: MProject