From: Alexis Laferrière Date: Thu, 4 Aug 2016 14:22:34 +0000 (-0400) Subject: serialization: AttributeTypeError doesn't need the message attribute, fix TODO X-Git-Url: http://nitlanguage.org?ds=sidebyside serialization: AttributeTypeError doesn't need the message attribute, fix TODO Signed-off-by: Alexis Laferrière --- diff --git a/lib/serialization/serialization.nit b/lib/serialization/serialization.nit index 8ae8d2f..0ad3019 100644 --- a/lib/serialization/serialization.nit +++ b/lib/serialization/serialization.nit @@ -143,6 +143,8 @@ end class AttributeTypeError super Error + autoinit receiver, attribute_name, attribute, expected_type + # Parent object of the problematic attribute var receiver: Object @@ -155,8 +157,7 @@ class AttributeTypeError # Name of the type expected for `attribute` var expected_type: String - redef fun to_s - do + redef var message is lazy do var attribute = attribute var found_type = if attribute != null then attribute.class_name else "null" diff --git a/src/frontend/serialization_phase.nit b/src/frontend/serialization_phase.nit index ddb0cce..2f07196 100644 --- a/src/frontend/serialization_phase.nit +++ b/src/frontend/serialization_phase.nit @@ -254,8 +254,7 @@ do var {{{name}}} = v.deserialize_attribute("{{{attribute.serialize_name}}}") if not {{{name}}} isa {{{type_name}}} then # Check if it was a subjectent error - v.errors.add new AttributeTypeError("TODO remove this arg on c_src regen", - self, "{{{attribute.serialize_name}}}", {{{name}}}, "{{{type_name}}}") + v.errors.add new AttributeTypeError(self, "{{{attribute.serialize_name}}}", {{{name}}}, "{{{type_name}}}") # Clear subjacent error if v.keep_going == false then return