1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00

Syntax.map rethrows errors.

This commit is contained in:
Rob Rix 2015-10-28 11:51:43 -04:00
parent 8db8a38d8e
commit d4aaf2eb55

View File

@ -8,16 +8,16 @@ public enum Syntax<Recur, A>: CustomDebugStringConvertible {
// MARK: Functor
public func map<T>(@noescape transform: Recur -> T) -> Syntax<T, A> {
public func map<T>(@noescape transform: Recur throws -> T) rethrows -> Syntax<T, A> {
switch self {
case let .Leaf(n):
return .Leaf(n)
case let .Indexed(x):
return .Indexed(x.map(transform))
return try .Indexed(x.map(transform))
case let .Fixed(x):
return .Fixed(x.map(transform))
return try .Fixed(x.map(transform))
case let .Keyed(d):
return .Keyed(Dictionary(elements: d.map { ($0, transform($1)) }))
return try .Keyed(Dictionary(elements: d.map { try ($0, transform($1)) }))
}
}