@@ -102,6 +102,7 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
102
102
self . defaultValue = defaultValue
103
103
}
104
104
105
+ @usableFromInline
105
106
var key : Builtin . RawPointer {
106
107
unsafeBitCast ( self , to: Builtin . RawPointer. self)
107
108
}
@@ -135,7 +136,10 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
135
136
/// If the value is a reference type, it will be retained for the duration of
136
137
/// the operation closure.
137
138
@discardableResult
139
+ @inline ( __always)
138
140
@_unsafeInheritExecutor
141
+ @available ( SwiftStdlib 5 . 1 , * ) // back deploy requires we declare the availability explicitly on this method
142
+ @_backDeploy ( before: macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 ) // SwiftStdlib 5.8 but it doesn't work with _backDeploy
139
143
public func withValue< R> ( _ valueDuringOperation: Value , operation: ( ) async throws -> R ,
140
144
file: String = #file, line: UInt = #line) async rethrows -> R {
141
145
// check if we're not trying to bind a value from an illegal context; this may crash
@@ -161,6 +165,7 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
161
165
/// If the value is a reference type, it will be retained for the duration of
162
166
/// the operation closure.
163
167
@discardableResult
168
+ @inline ( __always)
164
169
public func withValue< R> ( _ valueDuringOperation: Value , operation: ( ) throws -> R ,
165
170
file: String = #file, line: UInt = #line) rethrows -> R {
166
171
// check if we're not trying to bind a value from an illegal context; this may crash
@@ -172,6 +177,7 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
172
177
return try operation ( )
173
178
}
174
179
180
+ @inline ( __always)
175
181
public var projectedValue : TaskLocal < Value > {
176
182
get {
177
183
self
@@ -213,23 +219,27 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
213
219
// ==== ------------------------------------------------------------------------
214
220
215
221
@available ( SwiftStdlib 5 . 1 , * )
222
+ @usableFromInline
216
223
@_silgen_name ( " swift_task_localValuePush " )
217
224
func _taskLocalValuePush< Value> (
218
225
key: Builtin . RawPointer /*: Key*/,
219
226
value: __owned Value
220
227
) // where Key: TaskLocal
221
228
222
229
@available( SwiftStdlib 5 . 1 , * )
230
+ @usableFromInline
223
231
@_silgen_name ( " swift_task_localValuePop " )
224
232
func _taskLocalValuePop( )
225
233
226
234
@available( SwiftStdlib 5 . 1 , * )
235
+ @usableFromInline
227
236
@_silgen_name ( " swift_task_localValueGet " )
228
237
func _taskLocalValueGet(
229
238
key: Builtin . RawPointer /*Key*/
230
239
) -> UnsafeMutableRawPointer ? // where Key: TaskLocal
231
240
232
241
@available ( SwiftStdlib 5 . 1 , * )
242
+ @usableFromInline
233
243
@_silgen_name ( " swift_task_localsCopyTo " )
234
244
func _taskLocalsCopy(
235
245
to target: Builtin . NativeObject
0 commit comments