1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 module collect_super_sends
19 private import modelize_property
22 private class CollectSuperSends
24 var modelbuilder
: ModelBuilder
25 var res
= new ArraySet[MMethodDef]
26 var mpropdef
: nullable MMethodDef
28 # Get a new visitor on a classef to add type count in `typecount`.
29 init(modelbuilder
: ModelBuilder)
31 self.modelbuilder
= modelbuilder
36 if n
isa AMethPropdef then
37 assert mpropdef
== null
44 if n
isa ASuperExpr and n
.mproperty
== null then
52 redef class ModelBuilder
53 # Visit the AST and return all method definitions that performs a `super`.
54 fun collect_super_sends
: Set[MMethodDef]
56 var visitor
= new CollectSuperSends(self)
58 # Visit all the source code to collect data
59 for nmodule
in self.nmodules
do
60 visitor
.enter_visit
(nmodule
)