forked from jasder/antlr
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:
parent
23bc423259
commit
e327e4a13e
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue