sep_comp: SeparateRuntimeFunction::compile_to_c only declare if module is dead
authorJean Privat <jean@pryen.org>
Wed, 17 Jun 2015 01:23:45 +0000 (21:23 -0400)
committerJean Privat <jean@pryen.org>
Wed, 17 Jun 2015 12:42:17 +0000 (08:42 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/compiler/separate_compiler.nit

index 79cdb2f..b971cdb 100644 (file)
@@ -2216,6 +2216,11 @@ class SeparateRuntimeFunction
                var sig = "{c_ret} {c_name}{c_sig}"
                compiler.provide_declaration(self.c_name, "{sig};")
 
+               var rta = compiler.as(SeparateCompiler).runtime_type_analysis
+               if rta != null and not rta.live_mmodules.has(mmethoddef.mclassdef.mmodule) then
+                       return
+               end
+
                var recv = self.mmethoddef.mclassdef.bound_mtype
                var v = compiler.new_visitor
                var selfvar = new RuntimeVariable("self", called_recv, recv)