From: Alexis Laferrière Date: Tue, 30 Aug 2016 13:14:19 +0000 (-0400) Subject: frontend/serialization: missing nullable attribute are set to null X-Git-Url: http://nitlanguage.org frontend/serialization: missing nullable attribute are set to null Signed-off-by: Alexis Laferrière --- diff --git a/src/frontend/serialization_phase.nit b/src/frontend/serialization_phase.nit index c054558..9eb01a4 100644 --- a/src/frontend/serialization_phase.nit +++ b/src/frontend/serialization_phase.nit @@ -320,6 +320,9 @@ do # What to do when an attribute is missing? if attribute.has_value then # Leave it to the default value + else if mtype isa MNullableType then + code.add """ + self.{{{name}}} = null""" else code.add """ v.errors.add new Error("Deserialization Error: attribute `{class_name}::{{{name}}}` missing from JSON object")"""