From: Jean-Christophe Beaupré Date: Thu, 4 Aug 2016 16:39:53 +0000 (-0400) Subject: modelize_class: Do not crash if `Pointer` is not defined X-Git-Url: http://nitlanguage.org modelize_class: Do not crash if `Pointer` is not defined Signed-off-by: Jean-Christophe Beaupré --- 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.