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

18 lines
361 B
Swift

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