1
1
mirror of https://github.com/github/semantic.git synced 2025-01-02 12:23:08 +03:00

Parameterized Patch hashing.

This commit is contained in:
Rob Rix 2015-10-02 16:50:59 -04:00
parent ca6392e636
commit ae7f30e922

View File

@ -19,3 +19,15 @@ extension Patch {
&& Optional.equals(Fix.equals(param))(left.state.after, right.state.after)
}
}
// MARK: - Hashing
extension Patch {
public func hash(param: A -> Hash) -> Hash {
return Hash.Ordered([
state.before.map { $0.hash(param) } ?? Hash.Empty,
state.after.map { $0.hash(param) } ?? Hash.Empty
])
}
}