1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Construct diffs from terms.

This commit is contained in:
Rob Rix 2015-09-17 15:55:01 -04:00
parent 8a4a205055
commit 6e3d6a2209

View File

@ -11,6 +11,15 @@ public enum Diff: Comparable, CustomDebugStringConvertible, CustomDocConvertible
return .Patch(term, .Empty)
}
public init(_ term: Fix) {
switch term {
case .Empty:
self = .Empty
case let .Roll(s):
self = .Copy(s.map(Diff.init))
}
}
public var doc: Doc {
switch self {
case .Empty: