auto_super_init: use CallSite
[nit.git] / src / separate_compiler.nit
index 9bce4bd..09545e4 100644 (file)
@@ -906,8 +906,10 @@ class SeparateCompiler
        
        redef fun finalize_ffi_for_module(nmodule)
        do
+               var old_module = self.mainmodule
                self.mainmodule = nmodule.mmodule.as(not null)
                super
+               self.mainmodule = old_module
        end
 end
 
@@ -993,6 +995,8 @@ class SeparateCompilerVisitor
 
        private fun table_send(mmethod: MMethod, arguments: Array[RuntimeVariable], const_color: String): nullable RuntimeVariable
        do
+               assert arguments.length == mmethod.intro.msignature.arity + 1 else debug("Invalid arity for {mmethod}. {arguments.length} arguments given.")
+
                var res: nullable RuntimeVariable
                var msignature = mmethod.intro.msignature.resolve_for(mmethod.intro.mclassdef.bound_mtype, mmethod.intro.mclassdef.bound_mtype, mmethod.intro.mclassdef.mmodule, true)
                var ret = msignature.return_mtype
@@ -1047,7 +1051,7 @@ class SeparateCompilerVisitor
                                        self.add("{res} = 1; /* {arg.inspect} cannot be null */")
                                end
                        else
-                               self.add_abort("Reciever is null")
+                               self.add_abort("Receiver is null")
                        end
                        self.add("\} else \{")
                end
@@ -1088,6 +1092,8 @@ class SeparateCompilerVisitor
 
        redef fun call(mmethoddef, recvtype, arguments)
        do
+               assert arguments.length == mmethoddef.msignature.arity + 1 else debug("Invalid arity for {mmethoddef}. {arguments.length} arguments given.")
+
                var res: nullable RuntimeVariable
                var ret = mmethoddef.msignature.return_mtype
                if mmethoddef.mproperty.is_new then