From: Alexis Laferrière Date: Thu, 3 Jul 2014 00:08:01 +0000 (-0400) Subject: lib/serialization: accept Text as input X-Git-Tag: v0.6.7~75^2~5 X-Git-Url: http://nitlanguage.org lib/serialization: accept Text as input Signed-off-by: Alexis Laferrière --- diff --git a/lib/json/static.nit b/lib/json/static.nit index 3d3f0f0..51800fc 100644 --- a/lib/json/static.nit +++ b/lib/json/static.nit @@ -127,10 +127,10 @@ redef class Nelements_head redef fun items do return [n_value] end -redef class String +redef class Text fun json_to_nit_object: nullable Object do - var lexer = new Lexer_json(self) + var lexer = new Lexer_json(to_s) var parser = new Parser_json var tokens = lexer.lex parser.tokens.add_all(tokens) diff --git a/lib/json_serialization.nit b/lib/json_serialization.nit index c06c3f4..7b831da 100644 --- a/lib/json_serialization.nit +++ b/lib/json_serialization.nit @@ -77,7 +77,7 @@ class JsonDeserializer var just_opened_id: nullable Int = null - init(text: String) + init(text: Text) do var root = text.json_to_nit_object if root isa HashMap[String, nullable Object] then path.add(root)