Skip to content

Commit

Permalink
lib/serialization: serialize all insances of Text as we did with srings
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
  • Loading branch information
xymus committed Feb 12, 2016
1 parent 6c61e20 commit 298a7aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
14 changes: 6 additions & 8 deletions lib/binary/serialization.nit
Expand Up @@ -336,6 +336,12 @@ redef class Text

return true
end

redef fun serialize_to_binary(v)
do
v.stream.write_byte kind_string
v.stream.write_block to_s
end
end

# ---
Expand Down Expand Up @@ -397,14 +403,6 @@ redef class Char
end
end

redef class String
redef fun serialize_to_binary(v)
do
v.stream.write_byte kind_string
v.stream.write_block self
end
end

redef class NativeString
redef fun serialize_to_binary(v)
do
Expand Down
6 changes: 2 additions & 4 deletions lib/json/serialization.nit
Expand Up @@ -466,6 +466,8 @@ redef class Text
end
return res
end

redef fun serialize_to_json(v) do v.stream.write(to_json)
end

redef class Serializable
Expand Down Expand Up @@ -534,10 +536,6 @@ redef class Char
end
end

redef class String
redef fun serialize_to_json(v) do v.stream.write(to_json)
end

redef class NativeString
redef fun serialize_to_json(v) do to_s.serialize_to_json(v)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/serialization/serialization.nit
Expand Up @@ -221,7 +221,7 @@ redef class Char super DirectSerializable end
redef class Int super DirectSerializable end
redef class Float super DirectSerializable end
redef class NativeString super DirectSerializable end
redef class String super DirectSerializable end
redef class Text super DirectSerializable end
redef class SimpleCollection[E] super Serializable end
redef class Map[K, V] super Serializable end

Expand Down

0 comments on commit 298a7aa

Please sign in to comment.