frontend/serialization: leave missing attributes to their default value
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 30 Aug 2016 13:37:25 +0000 (09:37 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 30 Aug 2016 13:45:23 +0000 (09:45 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/frontend/serialization_phase.nit

index 3a1c9f5..7fc1c31 100644 (file)
@@ -314,7 +314,8 @@ do
 """
                        else code.add """
        var {{{name}}} = v.deserialize_attribute("{{{attribute.serialize_name}}}", "{{{type_name}}}")
-       if not {{{name}}} isa {{{type_name}}} then
+       if v.deserialize_attribute_missing then
+       else if not {{{name}}} isa {{{type_name}}} then
                v.errors.add new AttributeTypeError(self, "{{{attribute.serialize_name}}}", {{{name}}}, "{{{type_name}}}")
                if v.keep_going == false then return
        else