From: Alexis Laferrière Date: Thu, 11 Aug 2016 15:53:04 +0000 (-0400) Subject: frontend/serialization: pass the static type to the deserialization engine X-Git-Url: http://nitlanguage.org frontend/serialization: pass the static type to the deserialization engine Signed-off-by: Alexis Laferrière --- diff --git a/src/frontend/serialization_phase.nit b/src/frontend/serialization_phase.nit index 3d68c3b..b7b8031 100644 --- a/src/frontend/serialization_phase.nit +++ b/src/frontend/serialization_phase.nit @@ -292,7 +292,7 @@ private class SerializationPhasePostModel end end - # Add a constructor to the generated `init_npropdef` of `nclassdef` + # Fill the constructor to the generated `init_npropdef` of `nclassdef` fun fill_deserialization_init(nclassdef: AClassdef, init_npropdef: AMethPropdef, per_attribute: Bool) do var code = new Array[String] @@ -318,10 +318,10 @@ do if type_name == "nullable Object" then # Don't type check code.add """ - var {{{name}}} = v.deserialize_attribute("{{{attribute.serialize_name}}}") + var {{{name}}} = v.deserialize_attribute("{{{attribute.serialize_name}}}", "{{{type_name}}}") """ else code.add """ - var {{{name}}} = v.deserialize_attribute("{{{attribute.serialize_name}}}") + var {{{name}}} = v.deserialize_attribute("{{{attribute.serialize_name}}}", "{{{type_name}}}") if not {{{name}}} isa {{{type_name}}} then # Check if it was a subjectent error v.errors.add new AttributeTypeError(self, "{{{attribute.serialize_name}}}", {{{name}}}, "{{{type_name}}}")