From: Alexandre Terrasa Date: Mon, 4 Jul 2016 23:23:01 +0000 (-0400) Subject: model_collect: collect accessible methods and VTs X-Git-Url: http://nitlanguage.org model_collect: collect accessible methods and VTs Signed-off-by: Alexandre Terrasa --- diff --git a/src/model/model_collect.nit b/src/model/model_collect.nit index ab1296c..d4e40f4 100644 --- a/src/model/model_collect.nit +++ b/src/model/model_collect.nit @@ -424,6 +424,17 @@ redef class MClass return res end + # Collect all mmethods accessible by 'self' with `visibility >= min_visibility`. + # + # This include introduced, redefined, inherited mmethods. + fun collect_accessible_mmethods(view: ModelView): Set[MMethod] do + var set = new HashSet[MMethod] + set.add_all(collect_intro_mmethods(view)) + set.add_all(collect_redef_mmethods(view)) + set.add_all(collect_inherited_mmethods(view)) + return set + end + # Collect mattributes introduced in 'self' with `visibility >= min_visibility`. fun collect_intro_mattributes(view: ModelView): Set[MAttribute] do var res = new HashSet[MAttribute] @@ -515,6 +526,17 @@ redef class MClass set.add_all(collect_inherited_inits(view)) return set end + + # Collect all virtual types accessible by 'self' if accepted by `view`. + # + # This include introduced, redefined, inherited virtual types. + fun collect_accessible_vts(view: ModelView): Set[MVirtualTypeProp] do + var set = new HashSet[MVirtualTypeProp] + for mproperty in collect_accessible_mproperties(view) do + if mproperty isa MVirtualTypeProp then set.add mproperty + end + return set + end end redef class MClassDef