Skip to content

Commit cce8bfb

Browse files
[noescape by default] Migration to @NoEscape by default feature.
Adding @escaping option as required by the compiler.
1 parent 44174d9 commit cce8bfb

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/swift/Block.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ public class DispatchWorkItem {
4141

4242
// Temporary for swift-corelibs-foundation
4343
@available(*, deprecated, renamed: "DispatchWorkItem(qos:flags:block:)")
44-
public convenience init(group: DispatchGroup, qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], block: @convention(block) () -> ()) {
44+
public convenience init(group: DispatchGroup, qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], block: @escaping @convention(block) () -> ()) {
4545
self.init(qos: qos, flags: flags, block: block)
4646

4747
}
4848

49-
public init(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], block: @convention(block) () -> ()) {
49+
public init(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], block: @escaping @convention(block) () -> ()) {
5050
_block = dispatch_block_create_with_qos_class(dispatch_block_flags_t(flags.rawValue),
5151
qos.qosClass.rawValue.rawValue, Int32(qos.relativePriority), block)
5252
}
@@ -77,7 +77,7 @@ public class DispatchWorkItem {
7777
qos: DispatchQoS = .unspecified,
7878
flags: DispatchWorkItemFlags = [],
7979
queue: DispatchQueue,
80-
execute: @convention(block) () -> Void)
80+
execute: @escaping @convention(block) () -> ())
8181
{
8282
if qos != .unspecified || !flags.isEmpty {
8383
let item = DispatchWorkItem(qos: qos, flags: flags, block: execute)

src/swift/Dispatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public enum DispatchTimeoutResult {
134134
/// dispatch_group
135135

136136
public extension DispatchGroup {
137-
public func notify(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], queue: DispatchQueue, execute work: @convention(block) () -> ()) {
137+
public func notify(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], queue: DispatchQueue, execute work: @escaping @convention(block) () -> ()) {
138138
if #available(OSX 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
139139
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)
140140
dispatch_group_notify(self.__wrapped, queue.__wrapped, item._block)

src/swift/IO.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ public extension DispatchIO {
3434
public static let strictInterval = IntervalFlags(rawValue: 1)
3535
}
3636

37-
public class func read(fromFileDescriptor: Int32, maxLength: Int, runningHandlerOn queue: DispatchQueue, handler: (_ data: DispatchData, _ error: Int32) -> Void) {
37+
public class func read(fromFileDescriptor: Int32, maxLength: Int, runningHandlerOn queue: DispatchQueue, handler: @escaping (_ data: DispatchData, _ error: Int32) -> Void) {
3838
dispatch_read(fromFileDescriptor, maxLength, queue.__wrapped) { (data: dispatch_data_t, error: Int32) in
3939
handler(DispatchData(data: data), error)
4040
}
4141
}
4242

43-
public class func write(toFileDescriptor: Int32, data: DispatchData, runningHandlerOn queue: DispatchQueue, handler: (_ data: DispatchData?, _ error: Int32) -> Void) {
43+
public class func write(toFileDescriptor: Int32, data: DispatchData, runningHandlerOn queue: DispatchQueue, handler: @escaping (_ data: DispatchData?, _ error: Int32) -> Void) {
4444
dispatch_write(toFileDescriptor, data.__wrapped.__wrapped, queue.__wrapped) { (data: dispatch_data_t?, error: Int32) in
4545
handler(data.flatMap { DispatchData(data: $0) }, error)
4646
}
@@ -75,13 +75,13 @@ public extension DispatchIO {
7575
self.init(__type: type.rawValue, io: io, queue: queue, handler: cleanupHandler)
7676
}
7777

78-
public func read(offset: off_t, length: Int, queue: DispatchQueue, ioHandler: (_ done: Bool, _ data: DispatchData?, _ error: Int32) -> Void) {
78+
public func read(offset: off_t, length: Int, queue: DispatchQueue, ioHandler: @escaping (_ done: Bool, _ data: DispatchData?, _ error: Int32) -> Void) {
7979
dispatch_io_read(self.__wrapped, offset, length, queue.__wrapped) { (done: Bool, data: dispatch_data_t?, error: Int32) in
8080
ioHandler(done, data.flatMap { DispatchData(data: $0) }, error)
8181
}
8282
}
8383

84-
public func write(offset: off_t, data: DispatchData, queue: DispatchQueue, ioHandler: (_ done: Bool, _ data: DispatchData?, _ error: Int32) -> Void) {
84+
public func write(offset: off_t, data: DispatchData, queue: DispatchQueue, ioHandler: @escaping (_ done: Bool, _ data: DispatchData?, _ error: Int32) -> Void) {
8585
dispatch_io_write(self.__wrapped, offset, data.__wrapped.__wrapped, queue.__wrapped) { (done: Bool, data: dispatch_data_t?, error: Int32) in
8686
ioHandler(done, data.flatMap { DispatchData(data: $0) }, error)
8787
}

src/swift/Queue.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ public extension DispatchQueue {
221221
group: DispatchGroup? = nil,
222222
qos: DispatchQoS = .unspecified,
223223
flags: DispatchWorkItemFlags = [],
224-
execute work: @convention(block) () -> Void)
224+
execute work: @escaping @convention(block) () -> Void)
225225
{
226226
if group == nil && qos == .unspecified && flags.isEmpty {
227227
// Fast-path route for the most common API usage
228228
CDispatch.dispatch_async(self.__wrapped, work)
229229
return
230230
}
231231

232-
var block: @convention(block) () -> Void = work
232+
var block: @escaping @convention(block) () -> Void = work
233233
if #available(OSX 10.10, iOS 8.0, *), (qos != .unspecified || !flags.isEmpty) {
234234
let workItem = DispatchWorkItem(qos: qos, flags: flags, block: work)
235235
block = workItem._block
@@ -309,7 +309,7 @@ public extension DispatchQueue {
309309
deadline: DispatchTime,
310310
qos: DispatchQoS = .unspecified,
311311
flags: DispatchWorkItemFlags = [],
312-
execute work: @convention(block) () -> Void)
312+
execute work: @escaping @convention(block) () -> Void)
313313
{
314314
if #available(OSX 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
315315
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)
@@ -323,7 +323,7 @@ public extension DispatchQueue {
323323
wallDeadline: DispatchWallTime,
324324
qos: DispatchQoS = .unspecified,
325325
flags: DispatchWorkItemFlags = [],
326-
execute work: @convention(block) () -> Void)
326+
execute work: @escaping @convention(block) () -> Void)
327327
{
328328
if #available(OSX 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
329329
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)

src/swift/Wrapper.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,17 @@ public class DispatchIO : DispatchObject {
9191
}
9292

9393
internal init(__type: UInt, fd: Int32, queue: DispatchQueue,
94-
handler: (_ error: Int32) -> Void) {
94+
handler: @escaping (_ error: Int32) -> Void) {
9595
__wrapped = dispatch_io_create(__type, fd, queue.__wrapped, handler)
9696
}
9797

9898
internal init(__type: UInt, path: UnsafePointer<Int8>, oflag: Int32,
99-
mode: mode_t, queue: DispatchQueue, handler: (_ error: Int32) -> Void) {
99+
mode: mode_t, queue: DispatchQueue, handler: @escaping (_ error: Int32) -> Void) {
100100
__wrapped = dispatch_io_create_with_path(__type, path, oflag, mode, queue.__wrapped, handler)
101101
}
102102

103103
internal init(__type: UInt, io: DispatchIO,
104-
queue: DispatchQueue, handler: (_ error: Int32) -> Void) {
104+
queue: DispatchQueue, handler: @escaping (_ error: Int32) -> Void) {
105105
__wrapped = dispatch_io_create_with_io(__type, io.__wrapped, queue.__wrapped, handler)
106106
}
107107

@@ -113,7 +113,7 @@ public class DispatchIO : DispatchObject {
113113
_swift_dispatch_release(wrapped())
114114
}
115115

116-
public func barrier(execute: () -> ()) {
116+
public func barrier(execute: @escaping () -> ()) {
117117
dispatch_io_barrier(self.__wrapped, execute)
118118
}
119119

0 commit comments

Comments
 (0)