1
1
mirror of https://github.com/github/semantic.git synced 2024-11-23 16:37:50 +03:00

Diff is public.

This commit is contained in:
Rob Rix 2015-09-11 11:34:15 -04:00
parent 29e3aaf361
commit 8aa8f3d32f
2 changed files with 5 additions and 5 deletions

View File

@ -1,8 +1,8 @@
enum Diff: CustomDocConvertible, Equatable {
public enum Diff: CustomDocConvertible, Equatable {
case Patch(Syntax<Fix>, Syntax<Fix>)
case Copy(() -> Syntax<Diff>)
var doc: Doc<Pretty> {
public var doc: Doc<Pretty> {
switch self {
case let .Patch(a, b):
return .Horizontal([
@ -14,7 +14,7 @@ enum Diff: CustomDocConvertible, Equatable {
}
}
var description: String {
public var description: String {
switch self {
case let .Patch(a, b):
return ".Patch(\(a), \(b))"
@ -25,7 +25,7 @@ enum Diff: CustomDocConvertible, Equatable {
}
func diff(a: Syntax<Fix>, _ b: Syntax<Fix>) -> Diff {
public func diff(a: Syntax<Fix>, _ b: Syntax<Fix>) -> Diff {
switch (a, b) {
case let (.Apply(a, aa), .Apply(b, bb)):
return .Copy({ .Apply(diff(a.out, b.out), Array(zip(aa, bb).lazy.map { ($0.out, $1.out) }.map(diff))) })

View File

@ -21,7 +21,7 @@ public func == <F: Equatable> (left: Syntax<F>, right: Syntax<F>) -> Bool {
}
}
func == (left: Diff, right: Diff) -> Bool {
public func == (left: Diff, right: Diff) -> Bool {
switch (left, right) {
case let (.Patch(a1, b1), .Patch(a2, b2)):
return a1 == a2 && b1 == b2