tests: error_syntax errors on `? now
[nit.git] / contrib / neo_doxygen / src / model / location.nit
index 8652577..4e58af0 100644 (file)
 # This module is used to model locations in source files.
 module location
 
-import neo4j
+import json
 
 # A location inside a source file.
 class Location
-       super Jsonable
+       super Serializable
 
+       # The file’s path.
        var path: nullable String = null is writable
+
+       # The one-based index of the first line.
        var line_start: Int = 1 is writable
+
+       # The one-based index of the last line.
        var line_end: Int = 1 is writable
+
+       # The one-based column index of the first character.
        var column_start: Int = 1 is writable
+
+       # The one-based column index of the last character.
        var column_end: Int = 1 is writable
 
-       redef fun to_s: String do
+       redef fun to_s do
+               var path = path
                var file_part = "/dev/null:"
-               if path != null and path.length > 0 then file_part = "{path.as(not null)}:"
+               if path != null and path.length > 0 then file_part = "{path}:"
                return "{file_part}{line_start},{column_start}--{line_end},{column_end}"
        end
 
-       redef fun to_json do return to_s.to_json
+       redef fun serialize_to(v) do to_s.serialize_to v
+       redef fun accept_json_serializer(v) do to_s.serialize_to v
 end