1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 17:59:10 +03:00

Short-circuit for equal terms.

This commit is contained in:
Rob Rix 2015-09-29 12:54:32 -04:00
parent 7d36421d6a
commit dfbfb9fe79

View File

@ -46,6 +46,10 @@ public enum Diff: Comparable, CustomDebugStringConvertible, CustomDocConvertible
}
public init(_ a: Term, _ b: Term) {
if a == b {
self = Diff(b)
return
}
switch (a.syntax, b.syntax) {
case (.Empty, .Empty):
self = .Copy(.Empty)