model_utils: extract modifier list from mclassdef
authorAlexandre Terrasa <alexandre@moz-code.org>
Sat, 3 May 2014 03:32:58 +0000 (23:32 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Wed, 7 May 2014 06:02:52 +0000 (02:02 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/model_utils.nit

index 1c375ba..03ce173 100644 (file)
@@ -290,6 +290,20 @@ redef class MAttribute
        fun is_nullable: Bool do return intro.static_mtype isa MNullableType
 end
 
+redef class MClassDef
+       # modifiers are keywords like redef, private etc.
+       fun modifiers: Array[String] do
+               var res = new Array[String]
+               if not is_intro then
+                       res.add "redef"
+               else
+                       res.add mclass.visibility.to_s
+               end
+               res.add mclass.kind.to_s
+               return res
+       end
+end
+
 # Sorters
 
 # Sort mmodules by their name