serialization: AttributeTypeError doesn't need the message attribute, fix TODO
authorAlexis Laferrière <alexis.laf@xymus.net>
Thu, 4 Aug 2016 14:22:34 +0000 (10:22 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 4 Aug 2016 14:27:19 +0000 (10:27 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/serialization/serialization.nit
src/frontend/serialization_phase.nit

index 8ae8d2f..0ad3019 100644 (file)
@@ -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"
 
index ddb0cce..2f07196 100644 (file)
@@ -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