Merge commit 'b7e675f'
[nit.git] / src / auto_super_init.nit
index d939740..89362a2 100644 (file)
@@ -20,6 +20,16 @@ module auto_super_init
 
 import typing
 import modelbuilder
+import phase
+
+redef class ToolContext
+       var auto_super_init_phase: Phase = new AutoSuperInitPhase(self, [typing_phase])
+end
+
+private class AutoSuperInitPhase
+       super Phase
+       redef fun process_npropdef(npropdef) do if npropdef isa AConcreteMethPropdef then npropdef.do_auto_super_init(toolcontext.modelbuilder)
+end
 
 private class AutoSuperInitVisitor
        super Visitor
@@ -29,7 +39,6 @@ private class AutoSuperInitVisitor
 
        redef fun visit(n)
        do
-               if n == null then return
                n.accept_auto_super_init(self)
                n.visit_all(self)
        end
@@ -115,7 +124,7 @@ end
 redef class ASendExpr
        redef fun accept_auto_super_init(v)
        do
-               var mproperty = self.mproperty
+               var mproperty = self.callsite.mproperty
                if mproperty == null then return
                if mproperty.is_init then
                        v.has_explicit_super_init = true