From: Alexandre Terrasa Date: Sat, 3 May 2014 05:56:55 +0000 (-0400) Subject: model_utils: extract modifiers from mpropdef X-Git-Tag: v0.6.6~85^2~2 X-Git-Url: http://nitlanguage.org model_utils: extract modifiers from mpropdef Signed-off-by: Alexandre Terrasa --- diff --git a/src/model_utils.nit b/src/model_utils.nit index 03ce173..a8be901 100644 --- a/src/model_utils.nit +++ b/src/model_utils.nit @@ -304,6 +304,35 @@ redef class MClassDef end end +redef class MPropDef + # 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 mproperty.visibility.to_s + end + var mprop = self + if mprop isa MVirtualTypeDef then + res.add "type" + else if mprop isa MMethodDef then + if mprop.is_abstract then + res.add "abstract" + else if mprop.is_intern then + res.add "intern" + end + if mprop.mproperty.is_init then + res.add "init" + else + res.add "fun" + end + end + return res + end +end + + # Sorters # Sort mmodules by their name