var c = _array[i]
while c != null do
var ck = c._key
+ assert ck != null
if ck.is_same_serialized(k) then
break
end
end
end
+redef interface Object
+ # Is `self` the same as `other` in a serialization context?
+ #
+ # Used to determine if an object has already been serialized.
+ fun is_same_serialized(other: nullable Object): Bool do return is_same_instance(other)
+
+ # Hash value use for serialization
+ #
+ # Used in combination with `is_same_serialized`. If two objects are the same
+ # in a serialization context, they must have the same `serialization_hash`.
+ fun serialization_hash: Int do return object_id
+end
+
redef class Text
# Strip the `nullable` prefix from the type name `self`
init from_deserializer(deserializer: Deserializer) is nosuper do end
end
-redef interface Object
- # Is `self` the same as `other` in a serialization context?
- #
- # Used to determine if an object has already been serialized.
- fun is_same_serialized(other: nullable Object): Bool do return is_same_instance(other)
-
- # Hash value use for serialization
- #
- # Used in combination with `is_same_serialized`. If two objects are the same
- # in a serialization context, they must have the same `serialization_hash`.
- fun serialization_hash: Int do return object_id
-end
-
# Instances of this class are not delayed and instead serialized immediately
# This applies mainly to `universal` types
interface DirectSerializable
redef fun deserialize_class(name)
do
# Module: test_serialization
- if name == "Array[Text]" then return new Array[Text].from_deserializer(self)
if name == "Array[Map[String, nullable Object]]" then return new Array[Map[String, nullable Object]].from_deserializer(self)
if name == "Array[String]" then return new Array[String].from_deserializer(self)
- if name == "StrictHashMap[Int, Object]" then return new StrictHashMap[Int, Object].from_deserializer(self)
+ if name == "Array[Text]" then return new Array[Text].from_deserializer(self)
if name == "Array[Error]" then return new Array[Error].from_deserializer(self)
+ if name == "StrictHashMap[Int, Object]" then return new StrictHashMap[Int, Object].from_deserializer(self)
if name == "POSet[String]" then return new POSet[String].from_deserializer(self)
if name == "Array[Int]" then return new Array[Int].from_deserializer(self)
if name == "Array[nullable Object]" then return new Array[nullable Object].from_deserializer(self)