File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Sources/JavaScriptKit/FundamentalObjects Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,18 @@ public class JSOneshotClosure: JSObject, JSClosureProtocol {
6464public class JSClosure : JSFunction , JSClosureProtocol {
6565
6666 class SharedJSClosure {
67- private var storage : [ JavaScriptHostFuncRef : ( object: JSObject , body: ( sending [ JSValue ] ) -> JSValue ) ] = [ : ]
67+ // Note: 6.0 compilers built with assertions enabled crash when calling
68+ // `removeValue(forKey:)` on a dictionary with value type containing
69+ // `sending`. Wrap the value type with a struct to avoid the crash.
70+ struct Entry {
71+ let item : ( object: JSObject , body: ( sending [ JSValue ] ) -> JSValue )
72+ }
73+ private var storage : [ JavaScriptHostFuncRef : Entry ] = [ : ]
6874 init ( ) { }
6975
7076 subscript( _ key: JavaScriptHostFuncRef ) -> ( object: JSObject , body: ( sending [ JSValue ] ) -> JSValue ) ? {
71- get { storage [ key] }
72- set { storage [ key] = newValue }
77+ get { storage [ key] ? . item }
78+ set { storage [ key] = newValue. map { Entry ( item : $0 ) } }
7379 }
7480 }
7581
You can’t perform that action at this time.
0 commit comments