From 53217d03e55281253185057e997fc5e0e34303c0 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 28 Oct 2015 14:27:52 -0400 Subject: [PATCH] Info is CustomJSONConvertible. --- prototype/doubt-difftool/main.swift | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/prototype/doubt-difftool/main.swift b/prototype/doubt-difftool/main.swift index eadb2d1fa..9345da4e7 100644 --- a/prototype/doubt-difftool/main.swift +++ b/prototype/doubt-difftool/main.swift @@ -9,10 +9,26 @@ func readFile(path: String) -> String? { typealias Term = Cofree> -struct Info: Equatable { +struct Info: CustomJSONConvertible, Equatable { let range: Range let category: Category + + // MARK: CustomJSONConvertible + + var JSON: Doubt.JSON { + return [ + "range": [ + range.startIndex.JSON, + (range.endIndex - range.startIndex).JSON, + ], + "category": category.rawValue.JSON + ] + } + + + // MARK: Categories + enum Category: String { case Arguments = "arguments" case Assignment = "assignment"