From 402c491ec3964ab4c3e7c9c6a2c82d50fec4da8f Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Sat, 3 May 2014 01:56:55 -0400 Subject: [PATCH 1/1] model_utils: extract modifiers from mpropdef Signed-off-by: Alexandre Terrasa --- src/model_utils.nit | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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 -- 1.7.9.5