From: Jean Privat Date: Tue, 16 Jun 2015 13:30:17 +0000 (-0400) Subject: rta: no-op when AExpr::mtype or AExpr::cast_type is null X-Git-Tag: v0.7.6~34^2~3 X-Git-Url: http://nitlanguage.org rta: no-op when AExpr::mtype or AExpr::cast_type is null Signed-off-by: Jean Privat --- 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