From: Alexandre Terrasa Date: Wed, 25 Jun 2014 21:32:34 +0000 (-0400) Subject: model: introduce `name` in MEntity according to it's documentation X-Git-Tag: v0.6.6~15^2~1 X-Git-Url: http://nitlanguage.org model: introduce `name` in MEntity according to it's documentation Documentation was: # A named and possibly documented entity in the model. So I added the name... Signed-off-by: Alexandre Terrasa --- diff --git a/src/model/mmodule.nit b/src/model/mmodule.nit index 60a7c92..37c3ed0 100644 --- a/src/model/mmodule.nit +++ b/src/model/mmodule.nit @@ -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 diff --git a/src/model/model.nit b/src/model/model.nit index 6732a16..1094c63 100644 --- a/src/model/model.nit +++ b/src/model/model.nit @@ -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 diff --git a/src/model/model_base.nit b/src/model/model_base.nit index 39df50b..a51ec29 100644 --- a/src/model/model_base.nit +++ b/src/model/model_base.nit @@ -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) diff --git a/src/model/mproject.nit b/src/model/mproject.nit index cad2e39..4208008 100644 --- a/src/model/mproject.nit +++ b/src/model/mproject.nit @@ -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