1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 00:44:57 +03:00

JSONLeaf is CustomStringConvertible.

This commit is contained in:
Rob Rix 2015-10-07 20:08:34 -04:00
parent 981f6bd92e
commit 97e8f1725f

View File

@ -1,11 +1,25 @@
import Doubt
import Cocoa
enum JSONLeaf: Equatable {
enum JSONLeaf: Equatable, CustomStringConvertible {
case Number(Double)
case Boolean(Bool)
case String(Swift.String)
case Null
var description: Swift.String {
switch self {
case let .Number(n):
return Swift.String(n)
case let .Boolean(b):
return Swift.String(b)
case let .String(s):
return Swift.String(reflecting: s)
case .Null:
return "null"
}
}
}
func == (left: JSONLeaf, right: JSONLeaf) -> Bool {