From 7b4e28ab13894b8f2d5b5f2e7abbce942d631c7e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Christophe=20Beaupr=C3=A9?= Date: Thu, 4 Aug 2016 12:39:53 -0400 Subject: [PATCH] modelize_class: Do not crash if `Pointer` is not defined MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-Christophe Beaupré --- src/modelize/modelize_class.nit | 4 ++++ tests/sav/test_object_class_kind_alt4.res | 1 + 2 files changed, 5 insertions(+) create mode 100644 tests/sav/test_object_class_kind_alt4.res diff --git a/src/modelize/modelize_class.nit b/src/modelize/modelize_class.nit index 50a350c..2dfac9c 100644 --- a/src/modelize/modelize_class.nit +++ b/src/modelize/modelize_class.nit @@ -279,6 +279,10 @@ redef class ModelBuilder if mclassdef.is_intro and objectclass != null then if mclass.kind == extern_kind and mclass.name != "Pointer" then # it is an extern class, but not a Pointer + if pointerclass == null then + error(nclassdef, "Error: `Pointer` must be defined first.") + return + end if specpointer then supertypes.add pointerclass.mclass_type else if specobject then if mclass.name != "Object" then diff --git a/tests/sav/test_object_class_kind_alt4.res b/tests/sav/test_object_class_kind_alt4.res new file mode 100644 index 0000000..19f4896 --- /dev/null +++ b/tests/sav/test_object_class_kind_alt4.res @@ -0,0 +1 @@ +alt/test_object_class_kind_alt4.nit:21,14--19: Error: `Pointer` must be defined first. -- 1.7.9.5