From b235a50836dfa9434036f72f90150e7ef2de9ec1 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Mon, 4 Jul 2016 19:23:01 -0400 Subject: [PATCH] model_collect: collect accessible methods and VTs Signed-off-by: Alexandre Terrasa --- src/model/model_collect.nit | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 -- 1.7.9.5