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:
parent
8db8a38d8e
commit
d4aaf2eb55
@ -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)) }))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user