update all indirect references to native strings
[nit.git] / src / rapid_type_analysis.nit
index f763a56..99cf96c 100644 (file)
@@ -132,7 +132,7 @@ class RapidTypeAnalysis
                var types = typeset.to_a
                (new CachedAlphaComparator).sort(types)
                var res = new CsvDocument
-               res.format = new CsvFormat('"', ';', "\n")
+               res.separator = ';'
                res.header = ["Type", "Resolution", "Liveness", "Cast-liveness"]
                for t in types do
                        var reso
@@ -255,6 +255,8 @@ class RapidTypeAnalysis
                                add_cast(paramtype)
                        end
 
+                       if mmethoddef.is_abstract then continue
+
                        var npropdef = modelbuilder.mpropdef2node(mmethoddef)
 
                        if npropdef isa AClassdef then
@@ -311,10 +313,13 @@ class RapidTypeAnalysis
                                if not ot.can_resolve_for(t, t, mainmodule) then continue
                                var rt = ot.anchor_to(mainmodule, t)
                                if live_types.has(rt) then continue
+                               if not rt.is_legal_in(mainmodule) then continue
                                if not check_depth(rt) then continue
                                #print "{ot}/{t} -> {rt}"
                                live_types.add(rt)
-                               todo_types.add(rt)
+                               # unshift means a deep-first visit.
+                               # So that the `check_depth` limit is reached sooner.
+                               todo_types.unshift(rt)
                        end
                end
                #print "MType {live_types.length}: {live_types.join(", ")}"
@@ -325,6 +330,7 @@ class RapidTypeAnalysis
                        for t in live_types do
                                if not ot.can_resolve_for(t, t, mainmodule) then continue
                                var rt = ot.anchor_to(mainmodule, t)
+                               if not rt.is_legal_in(mainmodule) then continue
                                live_cast_types.add(rt)
                                #print "  {ot}/{t} -> {rt}"
                        end
@@ -581,10 +587,15 @@ end
 redef class AStringFormExpr
        redef fun accept_rapid_type_visitor(v)
        do
-               var native = v.analysis.mainmodule.native_string_type
+               var native = v.analysis.mainmodule.c_string_type
                v.add_type(native)
                var prop = v.get_method(native, "to_s_full")
                v.add_monomorphic_send(native, prop)
+               v.add_callsite(to_re)
+               v.add_callsite(ignore_case)
+               v.add_callsite(newline)
+               v.add_callsite(extended)
+               v.add_callsite(to_bytes_with_copy)
        end
 end