From 1932c5e8a293450d8bf4bb15881f87d8ec9f657c Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 16 Jun 2015 09:30:17 -0400 Subject: [PATCH] rta: no-op when AExpr::mtype or AExpr::cast_type is null Signed-off-by: Jean Privat --- src/rapid_type_analysis.nit | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/rapid_type_analysis.nit b/src/rapid_type_analysis.nit index 8fd6ed4..365f6a4 100644 --- a/src/rapid_type_analysis.nit +++ b/src/rapid_type_analysis.nit @@ -603,7 +603,8 @@ end redef class ACrangeExpr redef fun accept_rapid_type_visitor(v) do - var mtype = self.mtype.as(MClassType) + var mtype = self.mtype + if not mtype isa MClassType then return v.add_type(mtype) v.add_callsite(init_callsite) end @@ -612,7 +613,8 @@ end redef class AOrangeExpr redef fun accept_rapid_type_visitor(v) do - var mtype = self.mtype.as(MClassType) + var mtype = self.mtype + if not mtype isa MClassType then return v.add_type(mtype) v.add_callsite(init_callsite) end @@ -635,14 +637,18 @@ end redef class AIsaExpr redef fun accept_rapid_type_visitor(v) do - v.add_cast_type(self.cast_type.as(not null)) + var cast_type = self.cast_type + if cast_type == null then return + v.add_cast_type(cast_type) end end redef class AAsCastExpr redef fun accept_rapid_type_visitor(v) do - v.add_cast_type(self.mtype.as(not null)) + var mtype = self.mtype + if mtype == null then return + v.add_cast_type(mtype) end end -- 1.7.9.5