From: Jean Privat Date: Thu, 26 Feb 2015 13:02:37 +0000 (+0700) Subject: src: do not crash if there is not MAttributeDef in AAttrPropdef (abstract attribute) X-Git-Tag: v0.7.3~33^2~2 X-Git-Url: http://nitlanguage.org src: do not crash if there is not MAttributeDef in AAttrPropdef (abstract attribute) Signed-off-by: Jean Privat --- diff --git a/src/interpreter/naive_interpreter.nit b/src/interpreter/naive_interpreter.nit index 47b02cd..dd61428 100644 --- a/src/interpreter/naive_interpreter.nit +++ b/src/interpreter/naive_interpreter.nit @@ -1166,7 +1166,9 @@ redef class AAttrPropdef evaluate_expr(v, recv) return end - var mtype = self.mpropdef.static_mtype.as(not null) + var mpropdef = self.mpropdef + if mpropdef == null then return + var mtype = mpropdef.static_mtype.as(not null) mtype = mtype.anchor_to(v.mainmodule, recv.mtype.as(MClassType)) if mtype isa MNullableType then v.write_attribute(self.mpropdef.mproperty, recv, v.null_instance) diff --git a/src/semantize/typing.nit b/src/semantize/typing.nit index 343edbd..6a6d943 100644 --- a/src/semantize/typing.nit +++ b/src/semantize/typing.nit @@ -597,6 +597,8 @@ end redef class AAttrPropdef redef fun do_typing(modelbuilder: ModelBuilder) do + if not has_value then return + var mpropdef = self.mpropdef.as(not null) var v = new TypeVisitor(modelbuilder, mpropdef.mclassdef.mmodule, mpropdef) self.selfvariable = v.selfvariable