1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +03:00
semantic/prototype/doubt-difftool/Unified.swift

18 lines
361 B
Swift
Raw Normal View History

func unified(patch: Patch<Term>, source: String) -> String {
return (patch.state.before.map { "{-\($0)-}" } ?? "")
+ (patch.state.after.map { "{+\($0)+}" } ?? "")
}
2015-11-02 22:19:10 +03:00
func unified(diff: Diff, before: String, after: String) -> String {
2015-11-02 22:14:19 +03:00
switch diff {
case let .Pure(patch):
return unified(patch, source: after)
2015-11-02 22:14:19 +03:00
case .Roll:
return ""
}
}
import Doubt