mirror of
https://github.com/github/semantic.git
synced 2024-12-27 00:44:57 +03:00
Recur into Keyed nodes with equal keys.
This commit is contained in:
parent
4a38090f4a
commit
48ce6b7a7f
@ -93,6 +93,9 @@ public enum Algorithm<A, B> {
|
||||
case let (.Indexed(a), .Indexed(b)) where a.count == b.count:
|
||||
return f(.Indexed(zip(a, b).map(recur))).evaluate(equals, recur: recur)
|
||||
|
||||
case let (.Keyed(a), .Keyed(b)) where Array(a.keys) == Array(b.keys):
|
||||
return f(.Keyed(Dictionary(elements: b.keys.map { ($0, recur(a[$0]!, b[$0]!)) }))).evaluate(equals, recur: recur)
|
||||
|
||||
default:
|
||||
// This must not call `recur` with `a` and `b`, as that would infinite loop if actually recursive.
|
||||
return f(Diff.Pure(.Replace(a, b))).evaluate(equals, recur: recur)
|
||||
|
Loading…
Reference in New Issue
Block a user