       @start = pointB
       @end = pointA
 
+  serialize: ->
+    [@start.serialize(), @end.serialize()]
+
   copy: ->
-    new Range(@start.copy(), @end.copy())
+    new @constructor(@start.copy(), @end.copy())
 
   freeze: ->
     @start.freeze()

      endPoint.column = lines[lastIndex].length
    else
      endPoint.column += lines[0].length
    new Range(startPoint, endPoint)

  constructor: (pointA = new Point(0, 0), pointB = new Point(0, 0)) ->
    pointA = Point.fromObject(pointA)


  isEqual: (other) ->
    if Array.isArray(other) and other.length == 2
      other = new @constructor(other...)

    other.start.isEqual(@start) and other.end.isEqual(@end)

  compare: (other) ->
    other = @constructor.fromObject(other)
    if value = @start.compare(other.start)
      value
    else
