From a008359133277eee61c6297fa62a72f7441fa8a2 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 26 May 2015 15:05:20 -0400 Subject: [PATCH] rta: do not infinite loop if check_depth fails and --keep-going Signed-off-by: Jean Privat --- src/rapid_type_analysis.nit | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rapid_type_analysis.nit b/src/rapid_type_analysis.nit index 81e14fa..3be979a 100644 --- a/src/rapid_type_analysis.nit +++ b/src/rapid_type_analysis.nit @@ -296,10 +296,10 @@ 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 check_depth(rt) then continue #print "{ot}/{t} -> {rt}" live_types.add(rt) todo_types.add(rt) - check_depth(rt) end end #print "MType {live_types.length}: {live_types.join(", ")}" @@ -317,12 +317,14 @@ class RapidTypeAnalysis #print "cast MType {live_cast_types.length}: {live_cast_types.join(", ")}" end - private fun check_depth(mtype: MClassType) + private fun check_depth(mtype: MClassType): Bool do var d = mtype.length if d > 255 then self.modelbuilder.toolcontext.fatal_error(null, "Fatal Error: limitation in the rapidtype analysis engine: a type depth of {d} is too important, the problematic type is `{mtype}`.") + return false end + return true end fun add_new(recv: MClassType, mtype: MClassType) -- 1.7.9.5