From 7f89adf2d7bb94bc3fc2eeb7214c8dc98d5d4ec6 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 26 Feb 2015 20:02:37 +0700 Subject: [PATCH] src: do not crash if there is not MAttributeDef in AAttrPropdef (abstract attribute) Signed-off-by: Jean Privat --- src/interpreter/naive_interpreter.nit | 4 +++- src/semantize/typing.nit | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) 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 -- 1.7.9.5