Use auto equatable
This commit is contained in:
@@ -37,11 +37,6 @@ public struct TemplateSyntaxError : Error, Equatable, CustomStringConvertible {
|
|||||||
public init(_ description: String) {
|
public init(_ description: String) {
|
||||||
self.init(reason: description)
|
self.init(reason: description)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func ==(lhs:TemplateSyntaxError, rhs:TemplateSyntaxError) -> Bool {
|
|
||||||
return lhs.description == rhs.description && lhs.token == rhs.token && lhs.stackTrace == rhs.stackTrace
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Error {
|
extension Error {
|
||||||
|
|||||||
@@ -114,21 +114,4 @@ public enum Token : Equatable {
|
|||||||
return sourceMap
|
return sourceMap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public func == (lhs: Token, rhs: Token) -> Bool {
|
|
||||||
switch (lhs, rhs) {
|
|
||||||
case let (.text(lhsValue, lhsAt), .text(rhsValue, rhsAt)):
|
|
||||||
return lhsValue == rhsValue && lhsAt == rhsAt
|
|
||||||
case let (.variable(lhsValue, lhsAt), .variable(rhsValue, rhsAt)):
|
|
||||||
return lhsValue == rhsValue && lhsAt == rhsAt
|
|
||||||
case let (.block(lhsValue, lhsAt), .block(rhsValue, rhsAt)):
|
|
||||||
return lhsValue == rhsValue && lhsAt == rhsAt
|
|
||||||
case let (.comment(lhsValue, lhsAt), .comment(rhsValue, rhsAt)):
|
|
||||||
return lhsValue == rhsValue && lhsAt == rhsAt
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,10 +128,6 @@ public struct Variable : Equatable, Resolvable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func ==(lhs: Variable, rhs: Variable) -> Bool {
|
|
||||||
return lhs.variable == rhs.variable
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A structure used to represet range of two integer values expressed as `from...to`.
|
/// A structure used to represet range of two integer values expressed as `from...to`.
|
||||||
/// Values should be numbers (they will be converted to integers).
|
/// Values should be numbers (they will be converted to integers).
|
||||||
/// Rendering this variable produces array from range `from...to`.
|
/// Rendering this variable produces array from range `from...to`.
|
||||||
|
|||||||
Reference in New Issue
Block a user