mirror of
https://github.com/github/semantic.git
synced 2024-12-28 09:21:35 +03:00
Recur through pairs of .Keyed
nodes with equal keys.
This commit is contained in:
parent
52c1b581c6
commit
2dbfd51f15
@ -29,6 +29,9 @@ public struct Interpreter<Term: TermType> {
|
|||||||
case let (.Indexed(a), .Indexed(b)) where a.count == b.count:
|
case let (.Indexed(a), .Indexed(b)) where a.count == b.count:
|
||||||
return recur(f(.Indexed(zip(a, b).map(run))))
|
return recur(f(.Indexed(zip(a, b).map(run))))
|
||||||
|
|
||||||
|
case let (.Keyed(a), .Keyed(b)) where Array(a.keys) == Array(b.keys):
|
||||||
|
return recur(f(.Keyed(Dictionary(elements: b.keys.map { ($0, self.run(a[$0]!, b[$0]!)) }))))
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user