From f8fc94c5193af2e4e6aad1409883adc0245d2b26 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Thu, 5 Jun 2014 16:59:14 -0400 Subject: [PATCH] model_utils: extract mclass mproperties Signed-off-by: Alexandre Terrasa --- src/model_utils.nit | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/model_utils.nit b/src/model_utils.nit index 84d5d1d..b2c741b 100644 --- a/src/model_utils.nit +++ b/src/model_utils.nit @@ -200,6 +200,18 @@ redef class MClass return set end + fun intro_mpropdefs(min_visibility: MVisibility): Set[MPropDef] do + var set = new HashSet[MPropDef] + for mclassdef in mclassdefs do + for mpropdef in mclassdef.mpropdefs do + if not mpropdef.is_intro then continue + if mpropdef.mproperty.visibility < min_visibility then continue + set.add(mpropdef) + end + end + return set + end + # the set of locally refined properties in 'self'. fun redef_mproperties(min_visibility: MVisibility): Set[MProperty] do var set = new HashSet[MProperty] @@ -212,6 +224,18 @@ redef class MClass return set end + fun redef_mpropdefs(min_visibility: MVisibility): Set[MPropDef] do + var set = new HashSet[MPropDef] + for mclassdef in mclassdefs do + for mpropdef in mclassdef.mpropdefs do + if mpropdef.is_intro then continue + if mpropdef.mproperty.visibility < min_visibility then continue + set.add(mpropdef) + end + end + return set + end + # the set of methods inherited by 'self'. fun inherited_mproperties(mainmodule: MModule, min_visibility: MVisibility): Set[MProperty] do var set = new HashSet[MProperty] -- 1.7.9.5