@@ -44,7 +44,10 @@ import _CJavaScriptKit
4444/// ```
4545@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
4646public struct JSSending < T> : @unchecked Sendable {
47- fileprivate struct Storage {
47+ // HACK: We need to make this Storage "class" instead of "struct" to avoid using
48+ // outlined value operations in parameter-packed contexts, which leads to a
49+ // compiler crash. https://github.com/swiftlang/swift/pull/79201
50+ fileprivate class Storage {
4851 /// The original object that is sent.
4952 ///
5053 /// Retain it here to prevent it from being released before the sending is complete.
@@ -57,6 +60,20 @@ public struct JSSending<T>: @unchecked Sendable {
5760 let sourceTid : Int32
5861 /// Whether the object should be "transferred" or "cloned".
5962 let transferring : Bool
63+
64+ init (
65+ sourceObject: JSObject ,
66+ construct: @escaping ( _ object: JSObject ) -> T ,
67+ idInSource: JavaScriptObjectRef ,
68+ sourceTid: Int32 ,
69+ transferring: Bool
70+ ) {
71+ self . sourceObject = sourceObject
72+ self . construct = construct
73+ self . idInSource = idInSource
74+ self . sourceTid = sourceTid
75+ self . transferring = transferring
76+ }
6077 }
6178
6279 private let storage : Storage
0 commit comments