Change uses of functions deprecated in Swift 4.2.

This is three instances of flatMap changing to compactMap, and
one instance of UnsafeMutablePointer.deallocate(capacity:) changing
to UnsafeMutablePointer.deallocate().
This commit is contained in:
Ewan Mellor 2018-11-07 13:29:31 -08:00
parent 23bc423259
commit e327e4a13e
No known key found for this signature in database
GPG Key ID: 7CE1C6BC9EC8645D
3 changed files with 4 additions and 4 deletions

View File

@ -202,7 +202,7 @@ open class ParserRuleContext: RuleContext {
return [TerminalNode]()
}
return children.flatMap {
return children.compactMap {
if let tnode = $0 as? TerminalNode, let symbol = tnode.getSymbol(), symbol.getType() == ttype {
return tnode
}
@ -220,7 +220,7 @@ open class ParserRuleContext: RuleContext {
guard let children = children else {
return [T]()
}
return children.flatMap { $0 as? T }
return children.compactMap { $0 as? T }
}
override

View File

@ -427,7 +427,7 @@ public class SemanticContext: Hashable, CustomStringConvertible {
}
private static func filterPrecedencePredicates(_ collection: inout Set<SemanticContext>) -> [PrecedencePredicate] {
let result = collection.flatMap {
let result = collection.compactMap {
$0 as? PrecedencePredicate
}
collection = Set<SemanticContext>(collection.filter {

View File

@ -11,7 +11,7 @@ extension UUID {
public init(mostSigBits: Int64, leastSigBits: Int64) {
let bytes = UnsafeMutablePointer<UInt8>.allocate(capacity: 16)
defer {
bytes.deallocate(capacity: 16)
bytes.deallocate()
}
bytes.withMemoryRebound(to: Int64.self, capacity: 2) {
$0.pointee = leastSigBits