rta: `live_targets` do not crash when the receiver is null
authorJean Privat <jean@pryen.org>
Mon, 5 Jan 2015 02:55:06 +0000 (21:55 -0500)
committerJean Privat <jean@pryen.org>
Mon, 5 Jan 2015 02:55:06 +0000 (21:55 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/rapid_type_analysis.nit

index 7881db0..2d9fee4 100644 (file)
@@ -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