model_collect: collect accessible methods and VTs
[nit.git] / src / model / model_collect.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2008 Jean Privat <jean@pryen.org>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # Collect things from a `Model`.
18 #
19 # **Warning**
20 #
21 # `model_collect` offers a flattened view of the model without considering any
22 # main module.
23 # For this reason, `model_collect` lists all the definitions reachable from all
24 # modules
25 #
26 # This is usefull for tools that need a global view of a model like `nitdoc`,
27 # `nitx` or `nituml`.
28 # It should not be used for compiling stuffs like computing VFT, where the listed
29 # entities could not be reachable depending on the modules really imported.
30 module model_collect
31
32 import model_views
33
34 redef class MEntity
35
36 # FIXME used to bypass RTA limitation on type resolution.
37 type MENTITY: SELF
38
39 # Collect modifier keywords like `redef`, `private` etc.
40 fun collect_modifiers: Array[String] do
41 return new Array[String]
42 end
43
44 # Collect `self` linearization anchored on `mainmodule`.
45 fun collect_linearization(mainmodule: MModule): nullable Array[MEntity] do
46 return null
47 end
48
49 # Collect `self` ancestors (direct and indirect).
50 #
51 # The concept of ancestor is abstract at this stage.
52 fun collect_ancestors(view: ModelView): Set[MENTITY] do
53 var done = new HashSet[MENTITY]
54 var todo = new Array[MENTITY]
55
56 todo.add_all collect_parents(view)
57 while todo.not_empty do
58 var mentity = todo.pop
59 if mentity == self or done.has(mentity) then continue
60 print "{mentity} == {self}"
61 done.add mentity
62 todo.add_all mentity.collect_parents(view)
63 end
64 return done
65 end
66
67 # Collect `self` parents (direct ancestors).
68 #
69 # The concept of parent is abstract at this stage.
70 fun collect_parents(view: ModelView): Set[MENTITY] is abstract
71
72 # Collect `self` children (direct descendants).
73 #
74 # The concept of child is abstract at this stage.
75 fun collect_children(view: ModelView): Set[MENTITY] is abstract
76
77 # Collect `self` descendants (direct and direct).
78 #
79 # The concept of descendant is abstract at this stage.
80 fun collect_descendants(view: ModelView): Set[MENTITY] do
81 var done = new HashSet[MENTITY]
82 var todo = new Array[MENTITY]
83
84 todo.add_all collect_children(view)
85 while todo.not_empty do
86 var mentity = todo.pop
87 if mentity == self or done.has(mentity) then continue
88 done.add mentity
89 todo.add_all mentity.collect_children(view)
90 end
91 return done
92 end
93
94 # Build a poset representing `self` in it's own hierarchy.
95 #
96 # The notion of hierarchy depends on the type of MEntity.
97 #
98 # Here a recap:
99 # * MPackage: package dependencies
100 # * MGroup: group dependencies
101 # * MModule: modules imports
102 # * MClass: class inheritance (all classdefs flattened)
103 # * MClassDef: classdef inheritance
104 # * MProperty: property definitions graph (all propdefs flattened)
105 # * MPropDef: property definitions graph
106 fun hierarchy_poset(view: ModelView): POSet[MENTITY] do
107 var done = new HashSet[MENTITY]
108 var mentities = new Array[MENTITY]
109 mentities.add self
110 var poset = new POSet[MENTITY]
111 while mentities.not_empty do
112 var mentity = mentities.pop
113 if done.has(mentity) then continue
114 done.add mentity
115 poset.add_node mentity
116 for parent in mentity.collect_parents(view) do
117 poset.add_edge(mentity, parent)
118 mentities.add parent
119 end
120 for child in mentity.collect_children(view) do
121 poset.add_edge(child, mentity)
122 mentities.add child
123 end
124 end
125 return poset
126 end
127 end
128
129 redef class MPackage
130 redef fun collect_modifiers do
131 var res = super
132 res.add "package"
133 return res
134 end
135
136 # `MPackage` parents are its direct dependencies.
137 redef fun collect_parents(view) do
138 var res = new HashSet[MENTITY]
139 for mgroup in mgroups do
140 for parent in mgroup.collect_parents(view) do
141 var mpackage = parent.mpackage
142 if mpackage == self or not view.accept_mentity(mpackage) then continue
143 res.add(mpackage)
144 end
145 end
146 return res
147 end
148
149 # `MPackage` children are packages that directly depends on `self`.
150 redef fun collect_children(view) do
151 var res = new HashSet[MENTITY]
152 for mpackage in view.mpackages do
153 if mpackage.collect_parents(view).has(self) then res.add mpackage
154 end
155 return res
156 end
157 end
158
159 redef class MGroup
160 redef fun collect_modifiers do
161 var res = super
162 res.add "group"
163 return res
164 end
165
166 # `MGroup` parents are its direct dependencies.
167 redef fun collect_parents(view) do
168 var res = new HashSet[MENTITY]
169 for mmodule in mmodules do
170 for parent in mmodule.collect_parents(view) do
171 var mgroup = parent.mgroup
172 if mgroup == null or mgroup == self then continue
173 if not view.accept_mentity(mgroup) then continue
174 res.add(mgroup)
175 end
176 end
177 return res
178 end
179
180 # `MGroup` children are mgroups that directly depends on `self`.
181 redef fun collect_children(view) do
182 var res = new HashSet[MENTITY]
183 for mgroup in view.mgroups do
184 if mgroup == self or not view.accept_mentity(mgroup) then continue
185 if mgroup.collect_parents(view).has(self) then res.add mgroup
186 end
187 return res
188 end
189 end
190
191 redef class MModule
192
193 redef fun collect_modifiers do
194 var res = super
195 res.add "module"
196 return res
197 end
198
199 # `MModule` ancestors are all its transitive imports.
200 redef fun collect_ancestors(view) do
201 var res = new HashSet[MENTITY]
202 for mentity in in_importation.greaters do
203 if mentity == self then continue
204 if not view.accept_mentity(mentity) then continue
205 res.add mentity
206 end
207 return res
208 end
209
210 # `MModule` parents are all its direct imports.
211 redef fun collect_parents(view) do
212 var res = new HashSet[MENTITY]
213 for mentity in in_importation.direct_greaters do
214 if mentity == self then continue
215 if not view.accept_mentity(mentity) then continue
216 res.add mentity
217 end
218 return res
219 end
220
221 # `MModule` children are modules that directly import `self`.
222 redef fun collect_children(view) do
223 var res = new HashSet[MENTITY]
224 for mentity in in_importation.direct_smallers do
225 if mentity == self then continue
226 if not view.accept_mentity(mentity) then continue
227 res.add mentity
228 end
229 return res
230 end
231
232 # `MModule` children are modules that transitively import `self`.
233 redef fun collect_descendants(view) do
234 var res = new HashSet[MENTITY]
235 for mentity in in_importation.smallers do
236 if mentity == self then continue
237 if not view.accept_mentity(mentity) then continue
238 res.add mentity
239 end
240 return res
241 end
242
243 # Collect mclassdefs introduced in `self` with `visibility >= to min_visibility`.
244 fun collect_intro_mclassdefs(view: ModelView): Set[MClassDef] do
245 var res = new HashSet[MClassDef]
246 for mclassdef in mclassdefs do
247 if not mclassdef.is_intro then continue
248 if not view.accept_mentity(mclassdef) then continue
249 res.add mclassdef
250 end
251 return res
252 end
253
254 # Collect mclassdefs redefined in `self` with `visibility >= to min_visibility`.
255 fun collect_redef_mclassdefs(view: ModelView): Set[MClassDef] do
256 var res = new HashSet[MClassDef]
257 for mclassdef in mclassdefs do
258 if mclassdef.is_intro then continue
259 if not view.accept_mentity(mclassdef) then continue
260 res.add mclassdef
261 end
262 return res
263 end
264
265 # Collect mclasses introduced in `self` with `visibility >= to min_visibility`.
266 fun collect_intro_mclasses(view: ModelView): Set[MClass] do
267 var res = new HashSet[MClass]
268 for mclass in intro_mclasses do
269 if not view.accept_mentity(mclass) then continue
270 res.add mclass
271 end
272 return res
273 end
274
275 # Collect mclasses redefined in `self` with `visibility >= to min_visibility`.
276 fun collect_redef_mclasses(view: ModelView): Set[MClass] do
277 var mclasses = new HashSet[MClass]
278 for mclassdef in mclassdefs do
279 if not view.accept_mentity(mclassdef) then continue
280 if not mclassdef.is_intro then mclasses.add(mclassdef.mclass)
281 end
282 return mclasses
283 end
284 end
285
286 redef class MClass
287
288 redef fun collect_modifiers do return intro.collect_modifiers
289
290 redef fun collect_linearization(mainmodule) do
291 var mclassdefs = self.mclassdefs.to_a
292 mainmodule.linearize_mclassdefs(mclassdefs)
293 return mclassdefs
294 end
295
296 # `MClass` parents are the direct parents of `self`.
297 #
298 # This method uses a flattened hierarchy containing all the mclassdefs.
299 redef fun collect_parents(view) do
300 var res = new HashSet[MENTITY]
301 for mclassdef in mclassdefs do
302 for parent in mclassdef.collect_parents(view) do
303 var mclass = parent.mclass
304 if mclass == self or not view.accept_mentity(parent) then continue
305 res.add mclass
306 end
307 end
308 return res
309 end
310
311 # Collect all ancestors of `self` with `visibility >= to min_visibility`.
312 redef fun collect_ancestors(view) do
313 var res = new HashSet[MENTITY]
314 for mclassdef in mclassdefs do
315 for parent in mclassdef.collect_parents(view) do
316 if not view.accept_mentity(parent) then continue
317 res.add parent.mclass
318 end
319 end
320 return res
321 end
322
323 # `MClass` parents are the direct parents of `self`.
324 #
325 # This method uses a flattened hierarchy containing all the mclassdefs.
326 redef fun collect_children(view) do
327 var res = new HashSet[MENTITY]
328 for mclassdef in mclassdefs do
329 for child in mclassdef.collect_children(view) do
330 var mclass = child.mclass
331 if mclass == self or not view.accept_mentity(child) then continue
332 res.add mclass
333 end
334 end
335 return res
336 end
337
338 # Collect all mproperties introduced in 'self' with `visibility >= min_visibility`.
339 fun collect_intro_mproperties(view: ModelView): Set[MProperty] do
340 var set = new HashSet[MProperty]
341 for mclassdef in mclassdefs do
342 for mprop in mclassdef.intro_mproperties do
343 if not view.accept_mentity(mprop) then continue
344 set.add(mprop)
345 end
346 end
347 return set
348 end
349
350 # Collect all mproperties redefined in 'self' with `visibility >= min_visibility`.
351 fun collect_redef_mproperties(view: ModelView): Set[MProperty] do
352 var set = new HashSet[MProperty]
353 for mclassdef in mclassdefs do
354 for mpropdef in mclassdef.mpropdefs do
355 if mpropdef.mproperty.intro_mclassdef.mclass == self then continue
356 if not view.accept_mentity(mpropdef) then continue
357 set.add(mpropdef.mproperty)
358 end
359 end
360 return set
361 end
362
363 # Collect mproperties introduced and redefined in 'self' with `visibility >= min_visibility`.
364 fun collect_local_mproperties(view: ModelView): Set[MProperty] do
365 var set = new HashSet[MProperty]
366 set.add_all collect_intro_mproperties(view)
367 set.add_all collect_redef_mproperties(view)
368 return set
369 end
370
371 # Collect all mproperties inehrited by 'self' with `visibility >= min_visibility`.
372 fun collect_inherited_mproperties(view: ModelView): Set[MProperty] do
373 var set = new HashSet[MProperty]
374 for parent in collect_parents(view) do
375 set.add_all(parent.collect_intro_mproperties(view))
376 set.add_all(parent.collect_inherited_mproperties(view))
377 end
378 return set
379 end
380
381 # Collect all mproperties accessible by 'self' with `visibility >= min_visibility`.
382 #
383 # This include introduced, redefined, inherited mproperties.
384 fun collect_accessible_mproperties(view: ModelView): Set[MProperty] do
385 var set = new HashSet[MProperty]
386 set.add_all(collect_intro_mproperties(view))
387 set.add_all(collect_redef_mproperties(view))
388 set.add_all(collect_inherited_mproperties(view))
389 return set
390 end
391
392 # Collect mmethods introduced in 'self' with `visibility >= min_visibility`.
393 fun collect_intro_mmethods(view: ModelView): Set[MMethod] do
394 var res = new HashSet[MMethod]
395 for mproperty in collect_intro_mproperties(view) do
396 if mproperty isa MMethod then res.add(mproperty)
397 end
398 return res
399 end
400
401 # Collect mmethods redefined in 'self' with `visibility >= min_visibility`.
402 fun collect_redef_mmethods(view: ModelView): Set[MMethod] do
403 var res = new HashSet[MMethod]
404 for mproperty in collect_redef_mproperties(view) do
405 if mproperty isa MMethod then res.add(mproperty)
406 end
407 return res
408 end
409
410 # Collect mmethods introduced and redefined in 'self' with `visibility >= min_visibility`.
411 fun collect_local_mmethods(view: ModelView): Set[MMethod] do
412 var set = new HashSet[MMethod]
413 set.add_all collect_intro_mmethods(view)
414 set.add_all collect_redef_mmethods(view)
415 return set
416 end
417
418 # Collect mmethods inherited by 'self' if accepted by `view`.
419 fun collect_inherited_mmethods(view: ModelView): Set[MMethod] do
420 var res = new HashSet[MMethod]
421 for mproperty in collect_inherited_mproperties(view) do
422 if mproperty isa MMethod then res.add(mproperty)
423 end
424 return res
425 end
426
427 # Collect all mmethods accessible by 'self' with `visibility >= min_visibility`.
428 #
429 # This include introduced, redefined, inherited mmethods.
430 fun collect_accessible_mmethods(view: ModelView): Set[MMethod] do
431 var set = new HashSet[MMethod]
432 set.add_all(collect_intro_mmethods(view))
433 set.add_all(collect_redef_mmethods(view))
434 set.add_all(collect_inherited_mmethods(view))
435 return set
436 end
437
438 # Collect mattributes introduced in 'self' with `visibility >= min_visibility`.
439 fun collect_intro_mattributes(view: ModelView): Set[MAttribute] do
440 var res = new HashSet[MAttribute]
441 for mproperty in collect_intro_mproperties(view) do
442 if mproperty isa MAttribute then res.add(mproperty)
443 end
444 return res
445 end
446
447 # Collect mattributes redefined in 'self' with `visibility >= min_visibility`.
448 fun collect_redef_mattributes(view: ModelView): Set[MAttribute] do
449 var res = new HashSet[MAttribute]
450 for mproperty in collect_redef_mproperties(view) do
451 if mproperty isa MAttribute then res.add(mproperty)
452 end
453 return res
454 end
455
456 # Collect mattributes introduced and redefined in 'self' with `visibility >= min_visibility`.
457 fun collect_local_mattributes(view: ModelView): Set[MAttribute] do
458 var set = new HashSet[MAttribute]
459 set.add_all collect_intro_mattributes(view)
460 set.add_all collect_redef_mattributes(view)
461 return set
462 end
463
464 # Collect mattributes inherited by 'self' with `visibility >= min_visibility`.
465 fun collect_inherited_mattributes(view: ModelView): Set[MAttribute] do
466 var res = new HashSet[MAttribute]
467 for mproperty in collect_inherited_mproperties(view) do
468 if mproperty isa MAttribute then res.add(mproperty)
469 end
470 return res
471 end
472
473 # Collect all mattributes accessible by 'self' with `visibility >= min_visibility`.
474 #
475 # This include introduced, redefined, inherited mattributes.
476 fun collect_accessible_mattributes(view: ModelView): Set[MAttribute] do
477 var set = new HashSet[MAttribute]
478 set.add_all(collect_intro_mattributes(view))
479 set.add_all(collect_redef_mattributes(view))
480 set.add_all(collect_inherited_mattributes(view))
481 return set
482 end
483
484 # Collect init mmethods introduced in 'self' if accepted by `view`.
485 fun collect_intro_inits(view: ModelView): Set[MMethod] do
486 var res = new HashSet[MMethod]
487 for mproperty in collect_intro_mmethods(view) do
488 if mproperty.is_init then res.add(mproperty)
489 end
490 return res
491 end
492
493 # Collect init mmethods redefined in 'self' if accepted by `view`.
494 fun collect_redef_inits(view: ModelView): Set[MMethod] do
495 var res = new HashSet[MMethod]
496 for mproperty in collect_redef_mmethods(view) do
497 if mproperty.is_init then res.add(mproperty)
498 end
499 return res
500 end
501
502 # Collect init mmethods introduced and redefined in 'self' if accepted by `view`.
503 fun collect_local_inits(view: ModelView): Set[MMethod] do
504 var set = new HashSet[MMethod]
505 set.add_all collect_intro_inits(view)
506 set.add_all collect_redef_inits(view)
507 return set
508 end
509
510 # Collect init mmethods inherited by 'self' if accepted by `view`.
511 fun collect_inherited_inits(view: ModelView): Set[MMethod] do
512 var res = new HashSet[MMethod]
513 for mproperty in collect_inherited_mmethods(view) do
514 if mproperty.is_init then res.add(mproperty)
515 end
516 return res
517 end
518
519 # Collect all init mmethods accessible by 'self' if accepted by `view`.
520 #
521 # This include introduced, redefined, inherited inits.
522 fun collect_accessible_inits(view: ModelView): Set[MMethod] do
523 var set = new HashSet[MMethod]
524 set.add_all(collect_intro_inits(view))
525 set.add_all(collect_redef_inits(view))
526 set.add_all(collect_inherited_inits(view))
527 return set
528 end
529
530 # Collect all virtual types accessible by 'self' if accepted by `view`.
531 #
532 # This include introduced, redefined, inherited virtual types.
533 fun collect_accessible_vts(view: ModelView): Set[MVirtualTypeProp] do
534 var set = new HashSet[MVirtualTypeProp]
535 for mproperty in collect_accessible_mproperties(view) do
536 if mproperty isa MVirtualTypeProp then set.add mproperty
537 end
538 return set
539 end
540 end
541
542 redef class MClassDef
543
544 redef fun collect_linearization(mainmodule) do
545 var mclassdefs = new Array[MClassDef]
546 for mclassdef in in_hierarchy.as(not null).greaters do
547 if mclassdef.mclass == self.mclass then mclassdefs.add mclassdef
548 end
549 mainmodule.linearize_mclassdefs(mclassdefs)
550 return mclassdefs
551 end
552
553 # `MClassDef` ancestors are its direct and transitive super classes.
554 redef fun collect_ancestors(view) do
555 var res = new HashSet[MENTITY]
556 var hierarchy = self.in_hierarchy
557 if hierarchy == null then return res
558 for parent in hierarchy.greaters do
559 if parent == self or not view.accept_mentity(parent) then continue
560 res.add parent
561 end
562 return res
563 end
564
565 # `MClassDef` parents are its direct super classes.
566 redef fun collect_parents(view) do
567 var res = new HashSet[MENTITY]
568 var hierarchy = self.in_hierarchy
569 if hierarchy == null then return res
570 for parent in hierarchy.direct_greaters do
571 if parent == self or not view.accept_mentity(parent) then continue
572 res.add parent
573 end
574 return res
575 end
576
577 # `MClassDef` children are its direct subclasses.
578 redef fun collect_children(view) do
579 var res = new HashSet[MENTITY]
580 var hierarchy = self.in_hierarchy
581 if hierarchy == null then return res
582 for child in hierarchy.direct_smallers do
583 if child == self or not view.accept_mentity(child) then continue
584 res.add child
585 end
586 return res
587 end
588
589 # Collect mpropdefs in 'self' with `visibility >= min_visibility`.
590 fun collect_mpropdefs(view: ModelView): Set[MPropDef] do
591 var res = new HashSet[MPropDef]
592 for mpropdef in mpropdefs do
593 if not view.accept_mentity(mpropdef) then continue
594 res.add mpropdef
595 end
596 return res
597 end
598
599 # Collect mpropdefs introduced in 'self' with `visibility >= min_visibility`.
600 fun collect_intro_mpropdefs(view: ModelView): Set[MPropDef] do
601 var res = new HashSet[MPropDef]
602 for mpropdef in mpropdefs do
603 if not mpropdef.is_intro then continue
604 if not view.accept_mentity(mpropdef) then continue
605 res.add mpropdef
606 end
607 return res
608 end
609
610 # Collect mpropdefs redefined in 'self' with `visibility >= min_visibility`.
611 fun collect_redef_mpropdefs(view: ModelView): Set[MPropDef] do
612 var res = new HashSet[MPropDef]
613 for mpropdef in mpropdefs do
614 if mpropdef.is_intro then continue
615 if not view.accept_mentity(mpropdef) then continue
616 res.add mpropdef
617 end
618 return res
619 end
620
621 redef fun collect_modifiers do
622 var res = super
623 if not is_intro then
624 res.add "redef"
625 else
626 res.add mclass.visibility.to_s
627 end
628 res.add mclass.kind.to_s
629 return res
630 end
631 end
632
633 redef class MProperty
634 redef fun collect_modifiers do return intro.collect_modifiers
635
636 redef fun collect_linearization(mainmodule) do
637 var mpropdefs = self.mpropdefs.to_a
638 mainmodule.linearize_mpropdefs(mpropdefs)
639 return mpropdefs
640 end
641
642 # Collect mpropdefs in 'self' with `visibility >= min_visibility`.
643 fun collect_mpropdefs(view: ModelView): Set[MPropDef] do
644 var res = new HashSet[MPropDef]
645 for mpropdef in mpropdefs do
646 if not view.accept_mentity(mpropdef) then continue
647 res.add mpropdef
648 end
649 return res
650 end
651
652 # `MProperty` parents are all direct super definition of `self`.
653 #
654 # This method uses a flattened hierarchy containing all the mpropdefs.
655 redef fun collect_parents(view) do
656 var res = new HashSet[MENTITY]
657 for mpropdef in mpropdefs do
658 for parent in mpropdef.collect_parents(view) do
659 if not view.accept_mentity(parent) then continue
660 res.add parent.mproperty
661 end
662 end
663 return res
664 end
665
666 # `MProperty` parents are all direct sub definition of `self`.
667 #
668 # This method uses a flattened hierarchy containing all the mpropdefs.
669 redef fun collect_children(view) do
670 var res = new HashSet[MENTITY]
671 for mpropdef in mpropdefs do
672 for child in mpropdef.collect_parents(view) do
673 if not view.accept_mentity(child) then continue
674 res.add child.mproperty
675 end
676 end
677 return res
678 end
679 end
680
681 redef class MPropDef
682 redef fun collect_modifiers do
683 var res = super
684 if not is_intro then
685 res.add "redef"
686 else
687 res.add mproperty.visibility.to_s
688 end
689 var mprop = self
690 if mprop isa MVirtualTypeDef then
691 res.add "type"
692 else if mprop isa MMethodDef then
693 if mprop.is_abstract then
694 res.add "abstract"
695 else if mprop.is_intern then
696 res.add "intern"
697 end
698 if mprop.mproperty.is_init then
699 res.add "init"
700 else
701 res.add "fun"
702 end
703 else if mprop isa MAttributeDef then
704 res.add "var"
705 end
706 return res
707 end
708
709 redef fun collect_linearization(mainmodule) do
710 var mpropdefs = new Array[MPropDef]
711 var mentity = self
712 while not mentity.is_intro do
713 mpropdefs.add mentity
714 mentity = mentity.lookup_next_definition(mainmodule, mentity.mclassdef.bound_mtype)
715 end
716 mpropdefs.add mentity
717 mainmodule.linearize_mpropdefs(mpropdefs)
718 return mpropdefs
719 end
720
721 # `MPropDef` parents include only the next definition of `self`.
722 redef fun collect_parents(view) do
723 var res = new HashSet[MENTITY]
724 var mpropdef = self
725 while not mpropdef.is_intro do
726 mpropdef = mpropdef.lookup_next_definition(mclassdef.mmodule, mclassdef.bound_mtype)
727 res.add mpropdef
728 end
729 return res
730 end
731
732 # `MPropdef` children are definitions that directly depends on `self`.
733 redef fun collect_children(view) do
734 var res = new HashSet[MENTITY]
735 for mpropdef in mproperty.collect_mpropdefs(view) do
736 if mpropdef.collect_parents(view).has(self) then res.add mpropdef
737 end
738 return res
739 end
740 end