X-Git-Url: http://nitlanguage.org diff --git a/src/rapid_type_analysis.nit b/src/rapid_type_analysis.nit index 7fcb4bc..2d9fee4 100644 --- a/src/rapid_type_analysis.nit +++ b/src/rapid_type_analysis.nit @@ -87,8 +87,7 @@ class RapidTypeAnalysis var anchor = callsite.anchor if anchor != null then mtype = mtype.anchor_to(callsite.mmodule, anchor) mtype = mtype.as_notnullable - assert mtype isa MClassType - mtype = mtype.mclass.intro.bound_mtype + if mtype isa MClassType then mtype = mtype.mclass.intro.bound_mtype var mproperty = callsite.mproperty var res = live_targets_cache[mtype, mproperty] if res != null then return res @@ -111,7 +110,7 @@ class RapidTypeAnalysis # Return a ready-to-save CSV document objet that agregates informations about live types. # Each discovered type is listed in a line, with its status: resolution, liveness, cast-liveness. # Note: types are listed in an alphanumeric order to improve human reading. - fun live_types_to_csv: CSVDocument + fun live_types_to_csv: CsvDocument do # Gather all kind of type var typeset = new HashSet[MType] @@ -121,7 +120,8 @@ class RapidTypeAnalysis typeset.add_all(live_open_cast_types) var types = typeset.to_a (new CachedAlphaComparator).sort(types) - var res = new CSVDocument + var res = new CsvDocument + res.format = new CsvFormat('"', ';', "\n") res.header = ["Type", "Resolution", "Liveness", "Cast-liveness"] for t in types do var reso @@ -130,7 +130,7 @@ class RapidTypeAnalysis if t isa MClassType and (live_types.has(t) or live_open_types.has(t)) then live = "LIVE" else live = "DEAD" var cast if live_cast_types.has(t) or live_open_cast_types.has(t) then cast = "CAST LIVE" else cast = "CAST DEAD" - res.add_line(t, reso, live, cast) + res.add_record(t, reso, live, cast) end return res end @@ -343,10 +343,7 @@ class RapidTypeAnalysis var bound_mtype = mtype.anchor_to(mainmodule, recv) for cd in bound_mtype.collect_mclassdefs(mainmodule) do - if not self.modelbuilder.mclassdef2nclassdef.has_key(cd) then continue - var nclassdef = self.modelbuilder.mclassdef2nclassdef[cd] - for npropdef in nclassdef.n_propdefs do - if not npropdef isa AAttrPropdef then continue + for npropdef in modelbuilder.collect_attr_propdef(cd) do if not npropdef.has_value then continue var mpropdef = npropdef.mpropdef.as(not null)