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

Diff along the bottom of the edit graph.

This commit is contained in:
Rob Rix 2015-10-06 11:39:34 -04:00
parent f442f3594f
commit c090fc33d5

View File

@ -119,7 +119,13 @@ public enum FreeAlgorithm<A, B> {
var matrix: Matrix<Stream<Diff>>!
matrix = Matrix(width: a.count, height: b.count) { i, j in
let right = matrix[i + 1, j]
let here = Diff.Pure(Patch.Replace(a[i], b[j]))
// bottom extent of the edit graph; can only move right
if let right = right {
return Stream.Cons(here, right)
}
// bottom-right corner of the edit graph
return Stream.Cons(here, Memo(evaluated: Stream.Nil))
}