mirror of
https://github.com/github/semantic.git
synced 2025-01-01 11:46:14 +03:00
Move diff equality into Diff.swift.
This commit is contained in:
parent
8bac863ca0
commit
fb247732cc
@ -111,3 +111,15 @@ public enum Diff: Comparable, CustomDebugStringConvertible, CustomDocConvertible
|
||||
return Array(diff(Stream(sequence: a), Stream(sequence: b)).map { $0.0 })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public func == (left: Diff, right: Diff) -> Bool {
|
||||
switch (left, right) {
|
||||
case let (.Patch(a1, b1), .Patch(a2, b2)):
|
||||
return a1 == a2 && b1 == b2
|
||||
case let (.Copy(a), .Copy(b)):
|
||||
return a == b
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -19,17 +19,6 @@ public func == <F: Equatable, A: Equatable> (left: Syntax<F, A>, right: Syntax<F
|
||||
return equals(left, right, ==)
|
||||
}
|
||||
|
||||
public func == (left: Diff, right: Diff) -> Bool {
|
||||
switch (left, right) {
|
||||
case let (.Patch(a1, b1), .Patch(a2, b2)):
|
||||
return a1 == a2 && b1 == b2
|
||||
case let (.Copy(a), .Copy(b)):
|
||||
return a == b
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public func == (left: Doc, right: Doc) -> Bool {
|
||||
switch (left, right) {
|
||||
case (.Empty, .Empty), (.Line, .Line):
|
||||
|
Loading…
Reference in New Issue
Block a user