@@ -44,7 +44,10 @@ import _CJavaScriptKit
44
44
/// ```
45
45
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
46
46
public 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 {
48
51
/// The original object that is sent.
49
52
///
50
53
/// Retain it here to prevent it from being released before the sending is complete.
@@ -57,6 +60,20 @@ public struct JSSending<T>: @unchecked Sendable {
57
60
let sourceTid : Int32
58
61
/// Whether the object should be "transferred" or "cloned".
59
62
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
+ }
60
77
}
61
78
62
79
private let storage : Storage
0 commit comments