sep_comp: SeparateRuntimeFunction::compile_to_c only declare if module is dead
[nit.git] / src / rapid_type_analysis.nit
index d81d1c7..a89798f 100644 (file)
@@ -82,6 +82,10 @@ class RapidTypeAnalysis
        # Live methods.
        var live_methods = new HashSet[MMethod]
 
+       # Live mmodules.
+       # Those with a live method definitions (see `live_methoddefs`)
+       var live_mmodules = new HashSet[MModule]
+
        # Live callsites.
        var live_callsites = new HashSet[CallSite]
 
@@ -359,7 +363,7 @@ class RapidTypeAnalysis
                        for npropdef in modelbuilder.collect_attr_propdef(cd) do
                                if not npropdef.has_value then continue
 
-                               var mpropdef = npropdef.mpropdef.as(not null)
+                               var mpropdef = npropdef.mreadpropdef.as(not null)
                                var v = new RapidTypeVisitor(self, bound_mtype, mpropdef)
                                v.enter_visit(npropdef.n_expr)
                                v.enter_visit(npropdef.n_block)
@@ -389,6 +393,7 @@ class RapidTypeAnalysis
        do
                if live_methoddefs.has(mpropdef) then return
                live_methoddefs.add(mpropdef)
+               live_mmodules.add(mpropdef.mclassdef.mmodule)
                todo.add(mpropdef)
 
                var mproperty = mpropdef.mproperty