From f16f0651bcf3642b7ac52fbc90dd5f9e9db064e7 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 17 Apr 2026 11:17:58 +0200 Subject: [PATCH 01/14] feat: Add opt-in identityMode pointer for SwiftHeapObject wrapper identity caching Add identityMode: "pointer" option to BridgeJS instantiation. When enabled, a WeakRef-based identity cache keyed by pointer ensures the same Swift heap pointer returns the same JS wrapper (=== equality). Each class gets its own FinalizationRegistry and identity cache stored on the deinit function. Off by default, zero overhead when not enabled. --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 81 +++++++++++-- .../BridgeJSToolTests/BridgeJSLinkTests.swift | 28 +++++ .../BridgeJSLinkTests/ArrayTypes.d.ts | 1 + .../BridgeJSLinkTests/ArrayTypes.js | 68 +++++++++-- .../BridgeJSLinkTests/Async.d.ts | 1 + .../__Snapshots__/BridgeJSLinkTests/Async.js | 2 + .../BridgeJSLinkTests/AsyncImport.d.ts | 1 + .../BridgeJSLinkTests/AsyncImport.js | 2 + .../BridgeJSLinkTests/AsyncStaticImport.d.ts | 1 + .../BridgeJSLinkTests/AsyncStaticImport.js | 2 + .../BridgeJSLinkTests/DefaultParameters.d.ts | 1 + .../BridgeJSLinkTests/DefaultParameters.js | 68 +++++++++-- .../BridgeJSLinkTests/DictionaryTypes.d.ts | 1 + .../BridgeJSLinkTests/DictionaryTypes.js | 68 +++++++++-- .../EnumAssociatedValue.d.ts | 1 + .../BridgeJSLinkTests/EnumAssociatedValue.js | 68 +++++++++-- .../BridgeJSLinkTests/EnumCase.d.ts | 1 + .../BridgeJSLinkTests/EnumCase.js | 2 + .../EnumNamespace.Global.d.ts | 1 + .../BridgeJSLinkTests/EnumNamespace.Global.js | 68 +++++++++-- .../BridgeJSLinkTests/EnumNamespace.d.ts | 1 + .../BridgeJSLinkTests/EnumNamespace.js | 68 +++++++++-- .../BridgeJSLinkTests/EnumRawType.d.ts | 1 + .../BridgeJSLinkTests/EnumRawType.js | 2 + .../BridgeJSLinkTests/FixedWidthIntegers.d.ts | 1 + .../BridgeJSLinkTests/FixedWidthIntegers.js | 2 + .../BridgeJSLinkTests/GlobalGetter.d.ts | 1 + .../BridgeJSLinkTests/GlobalGetter.js | 2 + .../BridgeJSLinkTests/GlobalThisImports.d.ts | 1 + .../BridgeJSLinkTests/GlobalThisImports.js | 2 + .../BridgeJSLinkTests/ImportArray.d.ts | 1 + .../BridgeJSLinkTests/ImportArray.js | 2 + .../ImportedTypeInExportedInterface.d.ts | 1 + .../ImportedTypeInExportedInterface.js | 2 + .../InvalidPropertyNames.d.ts | 1 + .../BridgeJSLinkTests/InvalidPropertyNames.js | 2 + .../BridgeJSLinkTests/JSClass.d.ts | 1 + .../BridgeJSLinkTests/JSClass.js | 2 + .../JSClassStaticFunctions.d.ts | 1 + .../JSClassStaticFunctions.js | 2 + .../BridgeJSLinkTests/JSValue.d.ts | 1 + .../BridgeJSLinkTests/JSValue.js | 68 +++++++++-- .../BridgeJSLinkTests/MixedGlobal.d.ts | 1 + .../BridgeJSLinkTests/MixedGlobal.js | 68 +++++++++-- .../BridgeJSLinkTests/MixedModules.d.ts | 1 + .../BridgeJSLinkTests/MixedModules.js | 68 +++++++++-- .../BridgeJSLinkTests/MixedPrivate.d.ts | 1 + .../BridgeJSLinkTests/MixedPrivate.js | 68 +++++++++-- .../BridgeJSLinkTests/Namespaces.Global.d.ts | 1 + .../BridgeJSLinkTests/Namespaces.Global.js | 68 +++++++++-- .../BridgeJSLinkTests/Namespaces.d.ts | 1 + .../BridgeJSLinkTests/Namespaces.js | 68 +++++++++-- .../BridgeJSLinkTests/Optionals.d.ts | 1 + .../BridgeJSLinkTests/Optionals.js | 68 +++++++++-- .../PrimitiveParameters.d.ts | 1 + .../BridgeJSLinkTests/PrimitiveParameters.js | 2 + .../BridgeJSLinkTests/PrimitiveReturn.d.ts | 1 + .../BridgeJSLinkTests/PrimitiveReturn.js | 2 + .../BridgeJSLinkTests/PropertyTypes.d.ts | 1 + .../BridgeJSLinkTests/PropertyTypes.js | 68 +++++++++-- .../BridgeJSLinkTests/Protocol.d.ts | 1 + .../BridgeJSLinkTests/Protocol.js | 68 +++++++++-- .../BridgeJSLinkTests/ProtocolInClosure.d.ts | 1 + .../BridgeJSLinkTests/ProtocolInClosure.js | 68 +++++++++-- .../StaticFunctions.Global.d.ts | 1 + .../StaticFunctions.Global.js | 68 +++++++++-- .../BridgeJSLinkTests/StaticFunctions.d.ts | 1 + .../BridgeJSLinkTests/StaticFunctions.js | 68 +++++++++-- .../StaticProperties.Global.d.ts | 1 + .../StaticProperties.Global.js | 68 +++++++++-- .../BridgeJSLinkTests/StaticProperties.d.ts | 1 + .../BridgeJSLinkTests/StaticProperties.js | 68 +++++++++-- .../BridgeJSLinkTests/StringParameter.d.ts | 1 + .../BridgeJSLinkTests/StringParameter.js | 2 + .../BridgeJSLinkTests/StringReturn.d.ts | 1 + .../BridgeJSLinkTests/StringReturn.js | 2 + .../BridgeJSLinkTests/SwiftClass.d.ts | 1 + .../BridgeJSLinkTests/SwiftClass.js | 68 +++++++++-- .../BridgeJSLinkTests/SwiftClosure.d.ts | 1 + .../BridgeJSLinkTests/SwiftClosure.js | 68 +++++++++-- .../SwiftClosureImports.d.ts | 1 + .../BridgeJSLinkTests/SwiftClosureImports.js | 2 + .../BridgeJSLinkTests/SwiftStruct.d.ts | 1 + .../BridgeJSLinkTests/SwiftStruct.js | 68 +++++++++-- .../BridgeJSLinkTests/SwiftStructImports.d.ts | 1 + .../BridgeJSLinkTests/SwiftStructImports.js | 2 + .../BridgeJSLinkTests/Throws.d.ts | 1 + .../__Snapshots__/BridgeJSLinkTests/Throws.js | 2 + .../BridgeJSLinkTests/UnsafePointer.d.ts | 1 + .../BridgeJSLinkTests/UnsafePointer.js | 2 + .../VoidParameterVoidReturn.d.ts | 1 + .../VoidParameterVoidReturn.js | 2 + Plugins/PackageToJS/Templates/index.d.ts | 28 +++-- Plugins/PackageToJS/Templates/index.js | 6 + .../PackageToJS/Templates/instantiate.d.ts | 114 ++++++++++-------- 95 files changed, 1658 insertions(+), 252 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 60b34ff16..d4a7d2497 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -74,7 +74,7 @@ public struct BridgeJSLink { output += lifetimeTrackingClassJs + "\n" } output += """ - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { """ if enableLifetimeTracking { @@ -90,26 +90,81 @@ public struct BridgeJSLink { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + + """ + if enableLifetimeTracking { + output += " TRACKING.finalization(state);\n" + } + output += """ + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; """ if enableLifetimeTracking { - output += " TRACKING.wrap(pointer, deinit, prototype, state);\n" + output += " TRACKING.wrap(pointer, deinit, prototype, state);\n" } output += """ - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { """ if enableLifetimeTracking { - output += " TRACKING.release(this);\n" + output += " TRACKING.release(this);\n" } output += """ const state = this.__swiftHeapObjectState; @@ -117,7 +172,8 @@ public struct BridgeJSLink { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } @@ -915,6 +971,7 @@ public struct BridgeJSLink { printer.write("export function createInstantiator(options: {") printer.indent { printer.write("imports: Imports;") + printer.write("identityMode?: \"none\" | \"pointer\";") } printer.write("}, swift: any): Promise<{") printer.indent { @@ -960,6 +1017,10 @@ public struct BridgeJSLink { try printer.indent { printer.write(lines: generateVariableDeclarations()) + printer.write("const identityMode = options.identityMode === \"pointer\" ? \"pointer\" : \"none\";") + printer.write( + "const shouldUseIdentityMap = identityMode === \"pointer\" && typeof WeakRef !== \"undefined\" && typeof FinalizationRegistry !== \"undefined\";" + ) let bodyPrinter = CodeFragmentPrinter() let allStructs = exportedSkeletons.flatMap { $0.structs } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 711b04512..2c78b5ef3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -105,4 +105,32 @@ import Testing ) try snapshot(bridgeJSLink: bridgeJSLink, name: "MixedModules") } + + @Test + func emitsIdentityModeOptionAndRuntimeScaffolding() throws { + let url = Self.inputsDirectory.appendingPathComponent("SwiftClass.swift") + let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) + let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) + swiftAPI.addSourceFile(sourceFile, inputFilePath: "SwiftClass.swift") + let outputSkeleton = try swiftAPI.finalize() + let bridgeJSLink = BridgeJSLink( + skeletons: [ + outputSkeleton + ], + sharedMemory: false + ) + + let (outputJs, outputDts) = try bridgeJSLink.link() + + #expect(outputDts.contains("identityMode?: \"none\" | \"pointer\";")) + #expect( + outputJs.contains("const identityMode = options.identityMode === \"pointer\" ? \"pointer\" : \"none\";") + ) + #expect( + outputJs.contains( + "const shouldUseIdentityMap = identityMode === \"pointer\" && typeof WeakRef !== \"undefined\" && typeof FinalizationRegistry !== \"undefined\";" + ) + ) + #expect(outputJs.contains("if (!shouldUseIdentityMap) {")) + } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts index 255249eef..cf51c51f3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts @@ -88,6 +88,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 85e9c749a..5ada0b63e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -43,6 +43,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointHelpers = () => ({ lower: (value) => { f64Stack.push(value.x); @@ -343,7 +345,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -353,13 +355,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -368,7 +419,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts index aecab090e..29236eb44 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts @@ -17,6 +17,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index bf368738e..f5b100887 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.d.ts index e612ae1e1..46e521365 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.d.ts @@ -16,6 +16,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js index 89ab29827..c28de41ea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; function __bjs_jsValueLower(value) { let kind; let payload1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.d.ts index 491a66795..e93f46d69 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.d.ts @@ -16,6 +16,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js index 7fd6a0d6b..87e957112 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; function __bjs_jsValueLower(value) { let kind; let payload1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts index ac5658eb3..dca39489e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts @@ -158,6 +158,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 004320e4b..25815ac33 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -36,6 +36,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createConfigHelpers = () => ({ lower: (value) => { const bytes = textEncoder.encode(value.name); @@ -274,7 +276,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -284,13 +286,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -299,7 +350,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts index f14b29aa4..d31cf3d66 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts @@ -32,6 +32,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index b6cf2c253..3a0fae306 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createCountersHelpers = () => ({ lower: (value) => { const bytes = textEncoder.encode(value.name); @@ -283,7 +285,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -293,13 +295,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -308,7 +359,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts index 13f77ae08..eeb0cf428 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts @@ -192,6 +192,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index eb474d3b0..57391ae89 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -111,6 +111,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointHelpers = () => ({ lower: (value) => { f64Stack.push(value.x); @@ -950,7 +952,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -960,13 +962,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -975,7 +1026,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts index 5581df31e..c403d38b4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts @@ -53,6 +53,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index fe94c046f..4b1afa60d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -54,6 +54,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts index b78f0cecd..9fafb6f01 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts @@ -151,6 +151,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 948039cf9..182d88415 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -74,6 +74,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -266,7 +268,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -276,13 +278,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -291,7 +342,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts index 23d872d27..d8a145e3b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts @@ -112,6 +112,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 5201350b2..1477579db 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -55,6 +55,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -247,7 +249,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -257,13 +259,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -272,7 +323,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts index fbd5ad637..92f043b9d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts @@ -166,6 +166,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 7e5334811..2e3abb637 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -105,6 +105,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts index d6ab5aa8f..88ff36752 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts @@ -26,6 +26,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js index 53ddd7301..32ee37347 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts index 312f56786..d138fcdde 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts @@ -14,6 +14,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index 346b74eac..ec1237f66 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts index ae1152016..12ac7a310 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts @@ -16,6 +16,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index f74095374..be7deb1ea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts index 5d1e2c4dc..7b36ca3d8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts @@ -12,6 +12,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index 06cf6550e..ecb8cb821 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts index 22b4e6a1c..a1067c2ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts @@ -23,6 +23,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index c469fcb58..4dc2da4f5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createFooContainerHelpers = () => ({ lower: (value) => { let id; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts index ac0e05a91..af7e3ab7d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts @@ -30,6 +30,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index 952197c2a..846e08788 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts index aaf227cf7..80531f880 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts @@ -24,6 +24,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 88a5adb38..622285468 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts index 3b2b5de99..ab40d43c4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts @@ -25,6 +25,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index 10fafb7a0..19b2aa1d6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts index f4c13c610..2b74659a9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts @@ -33,6 +33,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 08675da6a..b3604ab74 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; function __bjs_jsValueLower(value) { let kind; let payload1; @@ -337,7 +339,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -347,13 +349,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -362,7 +413,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts index 7b4cc95e6..b093041e7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts @@ -26,6 +26,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index f4fe4dd61..c2fe2968a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -210,7 +212,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -220,13 +222,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -235,7 +286,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts index 88485232e..c0b6b13bd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts @@ -48,6 +48,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 4ce318f40..bb2cccf4c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -218,7 +220,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -228,13 +230,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -243,7 +294,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts index 193857072..169a25c84 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts @@ -26,6 +26,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 025a6fc8a..0d83959af 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -210,7 +212,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -220,13 +222,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -235,7 +286,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts index 1353220bc..242c11285 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts @@ -100,6 +100,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index f4596dba7..91ef6a5a1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -222,7 +224,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -232,13 +234,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -247,7 +298,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts index 6b2d65cd8..62a62b273 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts @@ -59,6 +59,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index 92ce69cbb..8e4a700a7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -222,7 +224,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -232,13 +234,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -247,7 +298,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts index a5a6e16fb..4b2944157 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts @@ -75,6 +75,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 37408a42d..7fe0e9fd0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -466,7 +468,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -476,13 +478,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -491,7 +542,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts index 961f97635..2adda19be 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts @@ -12,6 +12,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index 490f2b4e2..21ae7a2b1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts index 77e269d16..b524c9666 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts @@ -17,6 +17,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index bec07b959..95b23250a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts index 8f65849ab..f7ffa5b66 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts @@ -41,6 +41,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 658702a39..25c4c63f3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -210,7 +212,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -220,13 +222,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -235,7 +286,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts index 27cd9212b..1a8178c4f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts @@ -116,6 +116,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index f82e41703..5d6e3e767 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -54,6 +54,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createResultValuesHelpers = () => ({ lower: (value) => { const enumTag = value.tag; @@ -570,7 +572,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -580,13 +582,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -595,7 +646,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.d.ts index 6b7a9d28d..133982a77 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.d.ts @@ -31,6 +31,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js index 13070a3cc..7b8445b4a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } instance?.exports?.bjs_release_swift_closure(state.pointer); @@ -356,7 +358,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -366,13 +368,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -381,7 +432,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts index 5916e1648..6d1f908f8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts @@ -70,6 +70,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 42e25545e..c5b83ff23 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -41,6 +41,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createAPIResultValuesHelpers = () => ({ lower: (value) => { const enumTag = value.tag; @@ -254,7 +256,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -264,13 +266,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -279,7 +330,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts index c9cb26910..a49010973 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts @@ -60,6 +60,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 4cf9615fb..b2979b54a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -41,6 +41,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createAPIResultValuesHelpers = () => ({ lower: (value) => { const enumTag = value.tag; @@ -254,7 +256,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -264,13 +266,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -279,7 +330,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts index fea3c4b59..336f5589d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts @@ -65,6 +65,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 9928804eb..97d4ff183 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -35,6 +35,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -215,7 +217,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -225,13 +227,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -240,7 +291,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts index 4ce689edb..2972749cf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts @@ -51,6 +51,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index f82ac20df..4a102867c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -35,6 +35,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -215,7 +217,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -225,13 +227,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -240,7 +291,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts index 5e45162a1..8e3a8f98f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts @@ -14,6 +14,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index 033f08cd2..1ca98a411 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts index b43ff062c..98ed8ce88 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts @@ -12,6 +12,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 8187b9e92..14c34605b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts index 6d590950c..a450bf30f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts @@ -40,6 +40,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index cf9faa707..6ab3d427b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -238,7 +240,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -248,13 +250,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -263,7 +314,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts index ccc95eb3b..73635c41d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts @@ -97,6 +97,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 7e90c9415..101505de1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -60,6 +60,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } instance?.exports?.bjs_release_swift_closure(state.pointer); @@ -897,7 +899,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -907,13 +909,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -922,7 +973,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts index ebf493910..f08b5ac48 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts @@ -12,6 +12,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index d9df868ec..ac13ec16c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } instance?.exports?.bjs_release_swift_closure(state.pointer); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts index bf4ebc71f..0880baf02 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts @@ -86,6 +86,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index a60615686..f3e29bf21 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -35,6 +35,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createDataPointHelpers = () => ({ lower: (value) => { f64Stack.push(value.x); @@ -479,7 +481,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -489,13 +491,62 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { + static identityCacheByDeinit = new WeakMap(); + static finalizerByDeinit = new WeakMap(); + + static __getFinalizer(deinit) { + let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); + if (finalizer) { + return finalizer; + } + + const created = new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + SwiftHeapObject.finalizerByDeinit.set(deinit, created); + return created; + } + static __wrap(pointer, deinit, prototype) { - const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false }; - obj.pointer = pointer; - obj.__swiftHeapObjectState = state; - swiftHeapObjectFinalizationRegistry.register(obj, state, state); - return obj; + const makeFresh = (identityMap, finalizer) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + if (finalizer) { + finalizer.register(obj, state, state); + } + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!shouldUseIdentityMap) { + return makeFresh(null, swiftHeapObjectFinalizationRegistry); + } + + let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); + if (!identityMap) { + identityMap = new Map(); + SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); + } + + const cached = identityMap.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + return cached; + } + if (!cached) { + identityMap.delete(pointer); + } + + const finalizer = SwiftHeapObject.__getFinalizer(deinit); + return makeFresh(identityMap, finalizer); } release() { @@ -504,7 +555,8 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - swiftHeapObjectFinalizationRegistry.unregister(state); + state.finalizer?.unregister(state); + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts index 3677f1e44..cc963fe97 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts @@ -15,6 +15,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index d4f1160f3..f73ecfc2d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointHelpers = () => ({ lower: (value) => { i32Stack.push((value.x | 0)); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts index 9199ad1ae..1b9223753 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts @@ -11,6 +11,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index b2c381a03..acd2d4566 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts index 4f9aa4e4a..ac1c9b771 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts @@ -31,6 +31,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index ef81ef69e..f61606e02 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointerFieldsHelpers = () => ({ lower: (value) => { ptrStack.push((value.raw | 0)); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts index 7acba67a0..63276ca35 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts @@ -12,6 +12,7 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; + identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index 97948b286..d2b58d2da 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -30,6 +30,8 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/PackageToJS/Templates/index.d.ts b/Plugins/PackageToJS/Templates/index.d.ts index fb063f0ab..780d30845 100644 --- a/Plugins/PackageToJS/Templates/index.d.ts +++ b/Plugins/PackageToJS/Templates/index.d.ts @@ -1,21 +1,27 @@ -import type { Exports, Imports, ModuleSource } from './instantiate.js' +import type { Exports, Imports, ModuleSource } from "./instantiate.js"; export type Options = { -/* #if TARGET_DEFAULT_PLATFORM_BROWSER */ + /* #if TARGET_DEFAULT_PLATFORM_BROWSER */ /** * The WebAssembly module to instantiate * * If not provided, the module will be fetched from the default path. */ - module?: ModuleSource -/* #endif */ -/* #if HAS_IMPORTS */ + module?: ModuleSource; + /* #endif */ + /* #if HAS_IMPORTS */ /** * The imports to use for the module */ - getImports: () => Imports -/* #endif */ -} + getImports: () => Imports; + /* #endif */ + /** + * Controls whether exported Swift class instances use pointer-based identity mapping. + * When set to "pointer", the same Swift heap pointer will always return the same JS wrapper object. + * Defaults to "none". + */ + identityMode?: "none" | "pointer"; +}; /** * Instantiate and initialize the module @@ -24,6 +30,6 @@ export type Options = { * If you need a more flexible API, see `instantiate`. */ export declare function init(options?: Options): Promise<{ - instance: WebAssembly.Instance, - exports: Exports -}> + instance: WebAssembly.Instance; + exports: Exports; +}>; diff --git a/Plugins/PackageToJS/Templates/index.js b/Plugins/PackageToJS/Templates/index.js index 7cde8edc9..d7636c115 100644 --- a/Plugins/PackageToJS/Templates/index.js +++ b/Plugins/PackageToJS/Templates/index.js @@ -17,6 +17,9 @@ async function initNode(_options) { /* #endif */ }; const instantiateOptions = await defaultNodeSetup(options); + if (_options?.identityMode) { + instantiateOptions.identityMode = _options.identityMode; + } return await instantiate(instantiateOptions); } @@ -44,6 +47,9 @@ async function initBrowser(_options) { spawnWorker: createDefaultWorkerFactoryForBrowser() /* #endif */ }) + if (options?.identityMode) { + instantiateOptions.identityMode = options.identityMode; + } return await instantiate(instantiateOptions); } diff --git a/Plugins/PackageToJS/Templates/instantiate.d.ts b/Plugins/PackageToJS/Templates/instantiate.d.ts index 9074d8d2b..ca515b345 100644 --- a/Plugins/PackageToJS/Templates/instantiate.d.ts +++ b/Plugins/PackageToJS/Templates/instantiate.d.ts @@ -6,8 +6,8 @@ import type { SwiftRuntimeThreadChannel } from "./runtime.js"; export type { Imports, Exports } from "./bridge-js.js"; import type { Imports, Exports } from "./bridge-js.js"; /* #else */ -export type Imports = {} -export type Exports = {} +export type Imports = {}; +export type Exports = {}; /* #endif */ /** @@ -20,45 +20,50 @@ export declare const MODULE_PATH: string; * The type of the WebAssembly memory imported by the module */ export declare const MEMORY_TYPE: { - initial: number, - maximum: number, - shared: boolean -} + initial: number; + maximum: number; + shared: boolean; +}; /* #endif */ export interface WASI { /** * The WASI Preview 1 import object */ - wasiImport: WebAssembly.ModuleImports + wasiImport: WebAssembly.ModuleImports; /** * Initialize the WASI reactor instance * * @param instance - The instance of the WebAssembly module */ - initialize(instance: WebAssembly.Instance): void + initialize(instance: WebAssembly.Instance): void; /** * Set a new instance of the WebAssembly module to the WASI context * Typically used when instantiating a WebAssembly module for a thread * * @param instance - The instance of the WebAssembly module */ - setInstance(instance: WebAssembly.Instance): void + setInstance(instance: WebAssembly.Instance): void; /** * Extract a file from the WASI filesystem * * @param path - The path to the file to extract * @returns The data of the file if it was extracted, undefined otherwise */ - extractFile?(path: string): Uint8Array | undefined + extractFile?(path: string): Uint8Array | undefined; } export type SwiftRuntime = { - UnsafeEventLoopYield: { [Symbol.hasInstance]: (value: unknown) => boolean } + UnsafeEventLoopYield: { [Symbol.hasInstance]: (value: unknown) => boolean }; main(): void; startThread(tid: number, startArg: number): void; -} +}; -export type ModuleSource = WebAssembly.Module | ArrayBufferView | ArrayBuffer | Response | PromiseLike +export type ModuleSource = + | WebAssembly.Module + | ArrayBufferView + | ArrayBuffer + | Response + | PromiseLike; /** * The options for instantiating a WebAssembly module @@ -68,40 +73,44 @@ export type InstantiateOptions = { * The WebAssembly namespace to use for instantiation. * Defaults to the globalThis.WebAssembly object. */ - WebAssembly?: typeof globalThis.WebAssembly, + WebAssembly?: typeof globalThis.WebAssembly; /** * The WebAssembly module to instantiate */ - module: ModuleSource, -/* #if HAS_IMPORTS */ + module: ModuleSource; + /* #if HAS_IMPORTS */ /** * The function to get the imports provided by the embedder */ getImports: (importsContext: { - getInstance: () => WebAssembly.Instance | null, - getExports: () => Exports | null, - _swift: SwiftRuntime, - }) => Imports, -/* #endif */ -/* #if IS_WASI */ + getInstance: () => WebAssembly.Instance | null; + getExports: () => Exports | null; + _swift: SwiftRuntime; + }) => Imports; + /* #endif */ + /* #if IS_WASI */ /** * The WASI implementation to use */ - wasi: WASI, -/* #endif */ -/* #if USE_SHARED_MEMORY */ + wasi: WASI; + /* #endif */ + /* #if USE_SHARED_MEMORY */ /** * The WebAssembly memory to use (must be 'shared') */ - memory: WebAssembly.Memory + memory: WebAssembly.Memory; /** * The thread channel is a set of functions that are used to communicate * between the main thread and the worker thread. */ threadChannel: SwiftRuntimeThreadChannel & { - spawnThread: (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => number; - } -/* #endif */ + spawnThread: ( + module: WebAssembly.Module, + memory: WebAssembly.Memory, + startArg: any, + ) => number; + }; + /* #endif */ /** * Add imports to the WebAssembly import object * @param imports - The imports to add @@ -110,11 +119,11 @@ export type InstantiateOptions = { addToCoreImports?: ( imports: WebAssembly.Imports, context: { - getInstance: () => WebAssembly.Instance | null, - getExports: () => Exports | null, - _swift: SwiftRuntime, - } - ) => void + getInstance: () => WebAssembly.Instance | null; + getExports: () => Exports | null; + _swift: SwiftRuntime; + }, + ) => void; /** * Instrument the WebAssembly instance @@ -126,25 +135,36 @@ export type InstantiateOptions = { instrumentInstance?: ( instance: WebAssembly.Instance, context: { - _swift: SwiftRuntime - } - ) => WebAssembly.Instance -} + _swift: SwiftRuntime; + }, + ) => WebAssembly.Instance; + + /** + * Controls whether exported Swift class instances use pointer-based identity mapping. + * When set to "pointer", the same Swift heap pointer will always return the same JS wrapper object. + * Defaults to "none". + */ + identityMode?: "none" | "pointer"; +}; /** * Instantiate the given WebAssembly module */ export declare function instantiate(options: InstantiateOptions): Promise<{ - instance: WebAssembly.Instance, - swift: SwiftRuntime, - exports: Exports -}> + instance: WebAssembly.Instance; + swift: SwiftRuntime; + exports: Exports; +}>; /** * Instantiate the given WebAssembly module for a thread */ -export declare function instantiateForThread(tid: number, startArg: number, options: InstantiateOptions): Promise<{ - instance: WebAssembly.Instance, - swift: SwiftRuntime, - exports: Exports -}> +export declare function instantiateForThread( + tid: number, + startArg: number, + options: InstantiateOptions, +): Promise<{ + instance: WebAssembly.Instance; + swift: SwiftRuntime; + exports: Exports; +}>; From 2518e090fa492b65667804c1bdf8ab8e1d23f4ab Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 17 Apr 2026 11:17:58 +0200 Subject: [PATCH 02/14] refactor: Simplify pointer identity wrapping and class cache generation Replace per-class FinalizationRegistry instances with a single shared registry at module level. Move identity cache from deinit function property to per-class static __identityCache field. Cleaner codegen, fewer allocations, easier to inspect in DevTools. --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 47 +++------------- .../BridgeJSToolTests/BridgeJSLinkTests.swift | 13 +++++ .../BridgeJSLinkTests/ArrayTypes.js | 45 ++++------------ .../BridgeJSLinkTests/DefaultParameters.js | 49 +++++------------ .../BridgeJSLinkTests/DictionaryTypes.js | 41 +++----------- .../BridgeJSLinkTests/EnumAssociatedValue.js | 41 +++----------- .../BridgeJSLinkTests/EnumNamespace.Global.js | 53 ++++++------------- .../BridgeJSLinkTests/EnumNamespace.js | 53 ++++++------------- .../BridgeJSLinkTests/JSValue.js | 41 +++----------- .../BridgeJSLinkTests/MixedGlobal.js | 41 +++----------- .../BridgeJSLinkTests/MixedModules.js | 45 ++++------------ .../BridgeJSLinkTests/MixedPrivate.js | 41 +++----------- .../BridgeJSLinkTests/Namespaces.Global.js | 53 ++++++------------- .../BridgeJSLinkTests/Namespaces.js | 53 ++++++------------- .../BridgeJSLinkTests/Optionals.js | 45 ++++------------ .../BridgeJSLinkTests/PropertyTypes.js | 41 +++----------- .../BridgeJSLinkTests/Protocol.js | 49 +++++------------ .../BridgeJSLinkTests/ProtocolInClosure.js | 41 +++----------- .../StaticFunctions.Global.js | 41 +++----------- .../BridgeJSLinkTests/StaticFunctions.js | 41 +++----------- .../StaticProperties.Global.js | 41 +++----------- .../BridgeJSLinkTests/StaticProperties.js | 41 +++----------- .../BridgeJSLinkTests/SwiftClass.js | 49 +++++------------ .../BridgeJSLinkTests/SwiftClosure.js | 45 ++++------------ .../BridgeJSLinkTests/SwiftStruct.js | 41 +++----------- 25 files changed, 271 insertions(+), 820 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index d4a7d2497..c176664cc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -85,39 +85,13 @@ public struct BridgeJSLink { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - - """ - if enableLifetimeTracking { - output += " TRACKING.finalization(state);\n" - } - output += """ - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -142,22 +116,15 @@ public struct BridgeJSLink { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -2028,10 +1995,12 @@ extension BridgeJSLink { // Always add __construct and constructor methods for all classes jsPrinter.indent { + jsPrinter.write("static __identityCache = new Map();") + jsPrinter.nextLine() jsPrinter.write("static __construct(ptr) {") jsPrinter.indent { jsPrinter.write( - "return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_\(klass.abiName)_deinit, \(klass.name).prototype);" + "return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_\(klass.name)_deinit, \(klass.name).prototype, \(klass.name).__identityCache);" ) } jsPrinter.write("}") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 2c78b5ef3..877afe323 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -132,5 +132,18 @@ import Testing ) ) #expect(outputJs.contains("if (!shouldUseIdentityMap) {")) + #expect(outputJs.contains("state.identityMap?.delete(state.pointer);")) + #expect(!outputJs.contains("static finalizerByDeinit")) + #expect(!outputJs.contains("static __getFinalizer")) + #expect(!outputJs.contains("static identityCache = new Map();")) + #expect(!outputJs.contains("identityCacheByDeinit")) + #expect(!outputJs.contains("identityCache ??")) + #expect(outputJs.contains("static __wrap(pointer, deinit, prototype, identityCache)")) + #expect(outputJs.contains("static __identityCache = new Map();")) + #expect( + outputJs.contains( + "return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache);" + ) + ) } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 5ada0b63e..4f30e2593 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -350,33 +350,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -395,22 +375,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -425,14 +398,18 @@ export async function createInstantiator(options, swift) { } } class Item extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Item_deinit, Item.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Item_deinit, Item.prototype, Item.__identityCache); } } class MultiArrayContainer extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MultiArrayContainer_deinit, MultiArrayContainer.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MultiArrayContainer_deinit, MultiArrayContainer.prototype, MultiArrayContainer.__identityCache); } constructor(nums, strs) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 25815ac33..7b97b6608 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -281,33 +281,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -326,22 +306,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -356,8 +329,10 @@ export async function createInstantiator(options, swift) { } } class DefaultGreeter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DefaultGreeter_deinit, DefaultGreeter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DefaultGreeter_deinit, DefaultGreeter.prototype, DefaultGreeter.__identityCache); } constructor(name) { @@ -379,8 +354,10 @@ export async function createInstantiator(options, swift) { } } class EmptyGreeter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_EmptyGreeter_deinit, EmptyGreeter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_EmptyGreeter_deinit, EmptyGreeter.prototype, EmptyGreeter.__identityCache); } constructor() { @@ -389,8 +366,10 @@ export async function createInstantiator(options, swift) { } } class ConstructorDefaults extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_ConstructorDefaults_deinit, ConstructorDefaults.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_ConstructorDefaults_deinit, ConstructorDefaults.prototype, ConstructorDefaults.__identityCache); } constructor(name = "Default", count = 42, enabled = true, status = StatusValues.Active, tag = null) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 3a0fae306..d6529e0fa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -290,33 +290,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -335,22 +315,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -365,8 +338,10 @@ export async function createInstantiator(options, swift) { } } class Box extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Box_deinit, Box.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Box_deinit, Box.prototype, Box.__identityCache); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 57391ae89..4c48ed4f5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -957,33 +957,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -1002,22 +982,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -1032,8 +1005,10 @@ export async function createInstantiator(options, swift) { } } class User extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_User_deinit, User.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_User_deinit, User.prototype, User.__identityCache); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 182d88415..6dc03d882 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -273,33 +273,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -318,22 +298,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -348,8 +321,10 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converter_deinit, Converter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { @@ -371,8 +346,10 @@ export async function createInstantiator(options, swift) { } } class HTTPServer extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_API_HTTPServer_deinit, HTTPServer.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_HTTPServer_deinit, HTTPServer.prototype, HTTPServer.__identityCache); } constructor() { @@ -384,8 +361,10 @@ export async function createInstantiator(options, swift) { } } class TestServer extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_APIV2_Internal_TestServer_deinit, TestServer.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestServer_deinit, TestServer.prototype, TestServer.__identityCache); } constructor() { @@ -397,8 +376,10 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Formatting_Converter_deinit, Converter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 1477579db..58071b2b1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -254,33 +254,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -299,22 +279,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -329,8 +302,10 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converter_deinit, Converter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { @@ -352,8 +327,10 @@ export async function createInstantiator(options, swift) { } } class HTTPServer extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_API_HTTPServer_deinit, HTTPServer.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_HTTPServer_deinit, HTTPServer.prototype, HTTPServer.__identityCache); } constructor() { @@ -365,8 +342,10 @@ export async function createInstantiator(options, swift) { } } class TestServer extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_APIV2_Internal_TestServer_deinit, TestServer.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestServer_deinit, TestServer.prototype, TestServer.__identityCache); } constructor() { @@ -378,8 +357,10 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Formatting_Converter_deinit, Converter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index b3604ab74..61ac8dc3a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -344,33 +344,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -389,22 +369,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -419,8 +392,10 @@ export async function createInstantiator(options, swift) { } } class JSValueHolder extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_JSValueHolder_deinit, JSValueHolder.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_JSValueHolder_deinit, JSValueHolder.prototype, JSValueHolder.__identityCache); } constructor(value, optionalValue) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index c2fe2968a..9a96fa6b3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -217,33 +217,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -262,22 +242,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -292,8 +265,10 @@ export async function createInstantiator(options, swift) { } } class GlobalClass extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalAPI_GlobalClass_deinit, GlobalClass.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalClass_deinit, GlobalClass.prototype, GlobalClass.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index bb2cccf4c..f87d56d13 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -225,33 +225,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -270,22 +250,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -300,8 +273,10 @@ export async function createInstantiator(options, swift) { } } class GlobalClass extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalAPI_GlobalClass_deinit, GlobalClass.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalClass_deinit, GlobalClass.prototype, GlobalClass.__identityCache); } constructor() { @@ -316,8 +291,10 @@ export async function createInstantiator(options, swift) { } } class PrivateClass extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateAPI_PrivateClass_deinit, PrivateClass.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateClass_deinit, PrivateClass.prototype, PrivateClass.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 0d83959af..cd9530dc1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -217,33 +217,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -262,22 +242,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -292,8 +265,10 @@ export async function createInstantiator(options, swift) { } } class PrivateClass extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateAPI_PrivateClass_deinit, PrivateClass.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateClass_deinit, PrivateClass.prototype, PrivateClass.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 91ef6a5a1..a2291e6f3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -229,33 +229,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -274,22 +254,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -304,8 +277,10 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_Greeter_deinit, Greeter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); } constructor(name) { @@ -332,8 +307,10 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converters_Converter_deinit, Converter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { @@ -348,8 +325,10 @@ export async function createInstantiator(options, swift) { } } class UUID extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_UUID_deinit, UUID.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_UUID_deinit, UUID.prototype, UUID.__identityCache); } uuidString() { @@ -360,8 +339,10 @@ export async function createInstantiator(options, swift) { } } class Container extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Collections_Container_deinit, Container.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Container_deinit, Container.prototype, Container.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index 8e4a700a7..feb2a7eef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -229,33 +229,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -274,22 +254,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -304,8 +277,10 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_Greeter_deinit, Greeter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); } constructor(name) { @@ -332,8 +307,10 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converters_Converter_deinit, Converter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { @@ -348,8 +325,10 @@ export async function createInstantiator(options, swift) { } } class UUID extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_UUID_deinit, UUID.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_UUID_deinit, UUID.prototype, UUID.__identityCache); } uuidString() { @@ -360,8 +339,10 @@ export async function createInstantiator(options, swift) { } } class Container extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Collections_Container_deinit, Container.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Container_deinit, Container.prototype, Container.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 7fe0e9fd0..788ff2a66 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -473,33 +473,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -518,22 +498,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -548,8 +521,10 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); } constructor(name) { @@ -609,8 +584,10 @@ export async function createInstantiator(options, swift) { } } class OptionalPropertyHolder extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_OptionalPropertyHolder_deinit, OptionalPropertyHolder.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_OptionalPropertyHolder_deinit, OptionalPropertyHolder.prototype, OptionalPropertyHolder.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 25c4c63f3..0d0906823 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -217,33 +217,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -262,22 +242,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -292,8 +265,10 @@ export async function createInstantiator(options, swift) { } } class PropertyHolder extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyHolder_deinit, PropertyHolder.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyHolder_deinit, PropertyHolder.prototype, PropertyHolder.__identityCache); } constructor(intValue, floatValue, doubleValue, boolValue, stringValue, jsObject) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 5d6e3e767..5e72210bc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -577,33 +577,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -622,22 +602,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -652,8 +625,10 @@ export async function createInstantiator(options, swift) { } } class Helper extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Helper_deinit, Helper.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Helper_deinit, Helper.prototype, Helper.__identityCache); } constructor(value) { @@ -672,8 +647,10 @@ export async function createInstantiator(options, swift) { } } class MyViewController extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MyViewController_deinit, MyViewController.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MyViewController_deinit, MyViewController.prototype, MyViewController.__identityCache); } constructor(delegate) { @@ -733,8 +710,10 @@ export async function createInstantiator(options, swift) { } } class DelegateManager extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DelegateManager_deinit, DelegateManager.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DelegateManager_deinit, DelegateManager.prototype, DelegateManager.__identityCache); } constructor(delegates) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js index 7b8445b4a..92d2fef78 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js @@ -363,33 +363,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -408,22 +388,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -438,8 +411,10 @@ export async function createInstantiator(options, swift) { } } class Widget extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Widget_deinit, Widget.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Widget_deinit, Widget.prototype, Widget.__identityCache); } constructor(name) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index c5b83ff23..416f78ebe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -261,33 +261,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -306,22 +286,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -336,8 +309,10 @@ export async function createInstantiator(options, swift) { } } class MathUtils extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype, MathUtils.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index b2979b54a..b50063334 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -261,33 +261,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -306,22 +286,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -336,8 +309,10 @@ export async function createInstantiator(options, swift) { } } class MathUtils extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype, MathUtils.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 97d4ff183..aa412ae57 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -222,33 +222,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -267,22 +247,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -297,8 +270,10 @@ export async function createInstantiator(options, swift) { } } class PropertyClass extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype, PropertyClass.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index 4a102867c..a1db038ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -222,33 +222,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -267,22 +247,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -297,8 +270,10 @@ export async function createInstantiator(options, swift) { } } class PropertyClass extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype, PropertyClass.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 6ab3d427b..e464f547b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -245,33 +245,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -290,22 +270,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -320,8 +293,10 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); } constructor(name) { @@ -376,14 +351,18 @@ export async function createInstantiator(options, swift) { } } class PublicGreeter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PublicGreeter_deinit, PublicGreeter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PublicGreeter_deinit, PublicGreeter.prototype, PublicGreeter.__identityCache); } } class PackageGreeter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PackageGreeter_deinit, PackageGreeter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PackageGreeter_deinit, PackageGreeter.prototype, PackageGreeter.__identityCache); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 101505de1..a2590c4fa 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -904,33 +904,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -949,22 +929,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -979,8 +952,10 @@ export async function createInstantiator(options, swift) { } } class Person extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Person_deinit, Person.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Person_deinit, Person.prototype, Person.__identityCache); } constructor(name) { @@ -991,8 +966,10 @@ export async function createInstantiator(options, swift) { } } class TestProcessor extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestProcessor_deinit, TestProcessor.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestProcessor_deinit, TestProcessor.prototype, TestProcessor.__identityCache); } constructor(transform) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index f3e29bf21..0bd0ec578 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -486,33 +486,13 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; + state.identityMap?.delete(state.pointer); state.deinit(state.pointer); }); /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { - static identityCacheByDeinit = new WeakMap(); - static finalizerByDeinit = new WeakMap(); - - static __getFinalizer(deinit) { - let finalizer = SwiftHeapObject.finalizerByDeinit.get(deinit); - if (finalizer) { - return finalizer; - } - - const created = new FinalizationRegistry((state) => { - if (state.hasReleased) { - return; - } - state.hasReleased = true; - state.identityMap?.delete(state.pointer); - state.deinit(state.pointer); - }); - SwiftHeapObject.finalizerByDeinit.set(deinit, created); - return created; - } - - static __wrap(pointer, deinit, prototype) { + static __wrap(pointer, deinit, prototype, identityCache) { const makeFresh = (identityMap, finalizer) => { const obj = Object.create(prototype); const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; @@ -531,22 +511,15 @@ export async function createInstantiator(options, swift) { return makeFresh(null, swiftHeapObjectFinalizationRegistry); } - let identityMap = SwiftHeapObject.identityCacheByDeinit.get(deinit); - if (!identityMap) { - identityMap = new Map(); - SwiftHeapObject.identityCacheByDeinit.set(deinit, identityMap); - } - - const cached = identityMap.get(pointer)?.deref(); + const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { return cached; } if (!cached) { - identityMap.delete(pointer); + identityCache.delete(pointer); } - const finalizer = SwiftHeapObject.__getFinalizer(deinit); - return makeFresh(identityMap, finalizer); + return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); } release() { @@ -561,8 +534,10 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { + static __identityCache = new Map(); + static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); } constructor(name) { From 6189043fc11493dc8462577aa02a7f908f3e77eb Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 17 Apr 2026 11:17:58 +0200 Subject: [PATCH 03/14] fix: Fix retain leak on identity cache hit and namespace deinit reference Each boundary crossing calls passRetained on the Swift side. On cache hit, the wrapper is returned without creating a new FinalizationRegistry entry, leaving the retain unbalanced. Call deinit(pointer) on cache hit to immediately release the extra retain. Also fix deinit reference for namespaced classes to use abiName instead of short class name. --- Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift | 3 ++- .../__Snapshots__/BridgeJSLinkTests/ArrayTypes.js | 1 + .../__Snapshots__/BridgeJSLinkTests/DefaultParameters.js | 1 + .../__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js | 1 + .../BridgeJSLinkTests/EnumAssociatedValue.js | 1 + .../BridgeJSLinkTests/EnumNamespace.Global.js | 9 +++++---- .../__Snapshots__/BridgeJSLinkTests/EnumNamespace.js | 9 +++++---- .../__Snapshots__/BridgeJSLinkTests/JSValue.js | 1 + .../__Snapshots__/BridgeJSLinkTests/MixedGlobal.js | 3 ++- .../__Snapshots__/BridgeJSLinkTests/MixedModules.js | 5 +++-- .../__Snapshots__/BridgeJSLinkTests/MixedPrivate.js | 3 ++- .../__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js | 9 +++++---- .../__Snapshots__/BridgeJSLinkTests/Namespaces.js | 9 +++++---- .../__Snapshots__/BridgeJSLinkTests/Optionals.js | 1 + .../__Snapshots__/BridgeJSLinkTests/PropertyTypes.js | 1 + .../__Snapshots__/BridgeJSLinkTests/Protocol.js | 1 + .../__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js | 1 + .../BridgeJSLinkTests/StaticFunctions.Global.js | 1 + .../__Snapshots__/BridgeJSLinkTests/StaticFunctions.js | 1 + .../BridgeJSLinkTests/StaticProperties.Global.js | 1 + .../__Snapshots__/BridgeJSLinkTests/StaticProperties.js | 1 + .../__Snapshots__/BridgeJSLinkTests/SwiftClass.js | 1 + .../__Snapshots__/BridgeJSLinkTests/SwiftClosure.js | 1 + .../__Snapshots__/BridgeJSLinkTests/SwiftStruct.js | 1 + 24 files changed, 45 insertions(+), 21 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index c176664cc..e9cde70f5 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -118,6 +118,7 @@ public struct BridgeJSLink { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { @@ -2000,7 +2001,7 @@ extension BridgeJSLink { jsPrinter.write("static __construct(ptr) {") jsPrinter.indent { jsPrinter.write( - "return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_\(klass.name)_deinit, \(klass.name).prototype, \(klass.name).__identityCache);" + "return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_\(klass.abiName)_deinit, \(klass.name).prototype, \(klass.name).__identityCache);" ) } jsPrinter.write("}") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 4f30e2593..16ce6f57f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -377,6 +377,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 7b97b6608..92aee1923 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -308,6 +308,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index d6529e0fa..2001e8317 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -317,6 +317,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 4c48ed4f5..09f2cb7d0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -984,6 +984,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 6dc03d882..57d3474ef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -300,6 +300,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { @@ -324,7 +325,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { @@ -349,7 +350,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_HTTPServer_deinit, HTTPServer.prototype, HTTPServer.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_API_HTTPServer_deinit, HTTPServer.prototype, HTTPServer.__identityCache); } constructor() { @@ -364,7 +365,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestServer_deinit, TestServer.prototype, TestServer.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_APIV2_Internal_TestServer_deinit, TestServer.prototype, TestServer.__identityCache); } constructor() { @@ -379,7 +380,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Formatting_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 58071b2b1..958cf0eea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -281,6 +281,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { @@ -305,7 +306,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { @@ -330,7 +331,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_HTTPServer_deinit, HTTPServer.prototype, HTTPServer.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_API_HTTPServer_deinit, HTTPServer.prototype, HTTPServer.__identityCache); } constructor() { @@ -345,7 +346,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestServer_deinit, TestServer.prototype, TestServer.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_APIV2_Internal_TestServer_deinit, TestServer.prototype, TestServer.__identityCache); } constructor() { @@ -360,7 +361,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Formatting_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 61ac8dc3a..d5ea77cdd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -371,6 +371,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 9a96fa6b3..08682d8f8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -244,6 +244,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { @@ -268,7 +269,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalClass_deinit, GlobalClass.prototype, GlobalClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalAPI_GlobalClass_deinit, GlobalClass.prototype, GlobalClass.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index f87d56d13..9d8ee95f3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -252,6 +252,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { @@ -276,7 +277,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalClass_deinit, GlobalClass.prototype, GlobalClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalAPI_GlobalClass_deinit, GlobalClass.prototype, GlobalClass.__identityCache); } constructor() { @@ -294,7 +295,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateClass_deinit, PrivateClass.prototype, PrivateClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateAPI_PrivateClass_deinit, PrivateClass.prototype, PrivateClass.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index cd9530dc1..fd889531a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -244,6 +244,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { @@ -268,7 +269,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateClass_deinit, PrivateClass.prototype, PrivateClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateAPI_PrivateClass_deinit, PrivateClass.prototype, PrivateClass.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index a2291e6f3..2942770ac 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -256,6 +256,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { @@ -280,7 +281,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); } constructor(name) { @@ -310,7 +311,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converters_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { @@ -328,7 +329,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_UUID_deinit, UUID.prototype, UUID.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_UUID_deinit, UUID.prototype, UUID.__identityCache); } uuidString() { @@ -342,7 +343,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Container_deinit, Container.prototype, Container.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Collections_Container_deinit, Container.prototype, Container.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index feb2a7eef..332f9599d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -256,6 +256,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { @@ -280,7 +281,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); } constructor(name) { @@ -310,7 +311,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converters_Converter_deinit, Converter.prototype, Converter.__identityCache); } constructor() { @@ -328,7 +329,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_UUID_deinit, UUID.prototype, UUID.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_UUID_deinit, UUID.prototype, UUID.__identityCache); } uuidString() { @@ -342,7 +343,7 @@ export async function createInstantiator(options, swift) { static __identityCache = new Map(); static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Container_deinit, Container.prototype, Container.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Collections_Container_deinit, Container.prototype, Container.__identityCache); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 788ff2a66..a0577033c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -500,6 +500,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 0d0906823..240065d49 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -244,6 +244,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 5e72210bc..0f41bb817 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -604,6 +604,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js index 92d2fef78..4fbbea982 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js @@ -390,6 +390,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 416f78ebe..58c31e8e1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -288,6 +288,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index b50063334..74ebb41dd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -288,6 +288,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index aa412ae57..9224ec13d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -249,6 +249,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index a1db038ef..4e6b8e81c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -249,6 +249,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index e464f547b..2b268c50d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -272,6 +272,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index a2590c4fa..b4ad8ea58 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -931,6 +931,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index 0bd0ec578..84330e359 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -513,6 +513,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); return cached; } if (!cached) { From a865a008eddc002661433e584624d6215cc543d5 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 17 Apr 2026 11:17:58 +0200 Subject: [PATCH 04/14] test: Add identity mode E2E tests with dual-mode assertions Add Tests/BridgeJSRuntimeTests/IdentityModeSupportTests module covering: - Wrapper identity for shared Swift objects - Cache invalidation on release - Different classes don't collide on same pointer - Retain leak regression test for cache hits - Array identity preservation Wire IDENTITY_MODE env var through prelude.mjs to toggle instantiateOptions. Add unittest-pointer Makefile target for running tests with identityMode: "pointer". --- Makefile | 12 + .../Generated/BridgeJS.swift | 345 ++++++++++++++ .../Generated/JavaScript/BridgeJS.json | 423 ++++++++++++++++++ .../IdentityModeSupportTests.swift | 113 +++++ .../JavaScript/IdentityModeSupportTests.mjs | 239 ++++++++++ Tests/prelude.mjs | 5 + 6 files changed, 1137 insertions(+) create mode 100644 Tests/BridgeJSRuntimeTests/IdentityModeSupportTests.swift create mode 100644 Tests/BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs diff --git a/Makefile b/Makefile index 270eb9b36..df9aeb010 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,18 @@ unittest: --disable-sandbox \ js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc +.PHONY: unittest-pointer +unittest-pointer: + @echo Running unit tests with identityMode=pointer + @test -n "$(SWIFT_SDK_ID)" || { \ + echo "SWIFT_SDK_ID is not set. Run 'swift sdk list' and pass a matching SDK, e.g. 'make unittest-pointer SWIFT_SDK_ID='."; \ + exit 2; \ + } + IDENTITY_MODE=pointer swift package --swift-sdk "$(SWIFT_SDK_ID)" \ + $(TRACING_ARGS) \ + --disable-sandbox \ + js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc + .PHONY: regenerate_swiftpm_resources regenerate_swiftpm_resources: npm run build diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index a37a7e4c5..d28b05055 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -7656,6 +7656,132 @@ public func _bjs_makeAdder(_ base: Int32) -> Int32 { #endif } +@_expose(wasm, "bjs_getSharedSubject") +@_cdecl("bjs_getSharedSubject") +public func _bjs_getSharedSubject() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = getSharedSubject() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_resetSharedSubject") +@_cdecl("bjs_resetSharedSubject") +public func _bjs_resetSharedSubject() -> Void { + #if arch(wasm32) + resetSharedSubject() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getRetainLeakSubject") +@_cdecl("bjs_getRetainLeakSubject") +public func _bjs_getRetainLeakSubject() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = getRetainLeakSubject() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_resetRetainLeakSubject") +@_cdecl("bjs_resetRetainLeakSubject") +public func _bjs_resetRetainLeakSubject() -> Void { + #if arch(wasm32) + resetRetainLeakSubject() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getRetainLeakDeinits") +@_cdecl("bjs_getRetainLeakDeinits") +public func _bjs_getRetainLeakDeinits() -> Int32 { + #if arch(wasm32) + let ret = getRetainLeakDeinits() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_resetRetainLeakDeinits") +@_cdecl("bjs_resetRetainLeakDeinits") +public func _bjs_resetRetainLeakDeinits() -> Void { + #if arch(wasm32) + resetRetainLeakDeinits() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setupArrayPool") +@_cdecl("bjs_setupArrayPool") +public func _bjs_setupArrayPool(_ count: Int32) -> Void { + #if arch(wasm32) + setupArrayPool(_: Int.bridgeJSLiftParameter(count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getArrayPool") +@_cdecl("bjs_getArrayPool") +public func _bjs_getArrayPool() -> Void { + #if arch(wasm32) + let ret = getArrayPool() + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getArrayPoolElement") +@_cdecl("bjs_getArrayPoolElement") +public func _bjs_getArrayPoolElement(_ index: Int32) -> Void { + #if arch(wasm32) + let ret = getArrayPoolElement(_: Int.bridgeJSLiftParameter(index)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getArrayPoolDeinits") +@_cdecl("bjs_getArrayPoolDeinits") +public func _bjs_getArrayPoolDeinits() -> Int32 { + #if arch(wasm32) + let ret = getArrayPoolDeinits() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_resetArrayPoolDeinits") +@_cdecl("bjs_resetArrayPoolDeinits") +public func _bjs_resetArrayPoolDeinits() -> Void { + #if arch(wasm32) + resetArrayPoolDeinits() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_clearArrayPool") +@_cdecl("bjs_clearArrayPool") +public func _bjs_clearArrayPool() -> Void { + #if arch(wasm32) + clearArrayPool() + #else + fatalError("Only available on WebAssembly") + #endif +} + @_expose(wasm, "bjs_roundTripPointerFields") @_cdecl("bjs_roundTripPointerFields") public func _bjs_roundTripPointerFields() -> Void { @@ -10472,6 +10598,206 @@ fileprivate func _bjs_TextProcessor_wrap_extern(_ pointer: UnsafeMutableRawPoint return _bjs_TextProcessor_wrap_extern(pointer) } +@_expose(wasm, "bjs_IdentityTestSubject_init") +@_cdecl("bjs_IdentityTestSubject_init") +public func _bjs_IdentityTestSubject_init(_ value: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = IdentityTestSubject(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityTestSubject_value_get") +@_cdecl("bjs_IdentityTestSubject_value_get") +public func _bjs_IdentityTestSubject_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).value + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityTestSubject_value_set") +@_cdecl("bjs_IdentityTestSubject_value_set") +public func _bjs_IdentityTestSubject_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + IdentityTestSubject.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityTestSubject_currentValue_get") +@_cdecl("bjs_IdentityTestSubject_currentValue_get") +public func _bjs_IdentityTestSubject_currentValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).currentValue + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityTestSubject_deinit") +@_cdecl("bjs_IdentityTestSubject_deinit") +public func _bjs_IdentityTestSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension IdentityTestSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IdentityTestSubject_wrap") +fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_IdentityTestSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_IdentityTestSubject_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_RetainLeakSubject_init") +@_cdecl("bjs_RetainLeakSubject_init") +public func _bjs_RetainLeakSubject_init(_ tag: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = RetainLeakSubject(tag: Int.bridgeJSLiftParameter(tag)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_RetainLeakSubject_tag_get") +@_cdecl("bjs_RetainLeakSubject_tag_get") +public func _bjs_RetainLeakSubject_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = RetainLeakSubject.bridgeJSLiftParameter(_self).tag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_RetainLeakSubject_tag_set") +@_cdecl("bjs_RetainLeakSubject_tag_set") +public func _bjs_RetainLeakSubject_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + RetainLeakSubject.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_RetainLeakSubject_deinit") +@_cdecl("bjs_RetainLeakSubject_deinit") +public func _bjs_RetainLeakSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension RetainLeakSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_RetainLeakSubject_wrap") +fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_RetainLeakSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_RetainLeakSubject_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_ArrayIdentityElement_init") +@_cdecl("bjs_ArrayIdentityElement_init") +public func _bjs_ArrayIdentityElement_init(_ tag: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ArrayIdentityElement(tag: Int.bridgeJSLiftParameter(tag)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayIdentityElement_tag_get") +@_cdecl("bjs_ArrayIdentityElement_tag_get") +public func _bjs_ArrayIdentityElement_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = ArrayIdentityElement.bridgeJSLiftParameter(_self).tag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayIdentityElement_tag_set") +@_cdecl("bjs_ArrayIdentityElement_tag_set") +public func _bjs_ArrayIdentityElement_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + ArrayIdentityElement.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayIdentityElement_deinit") +@_cdecl("bjs_ArrayIdentityElement_deinit") +public func _bjs_ArrayIdentityElement_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension ArrayIdentityElement: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayIdentityElement_wrap") +fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_ArrayIdentityElement_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ArrayIdentityElement_wrap_extern(pointer) +} + @_expose(wasm, "bjs_OptionalHolder_init") @_cdecl("bjs_OptionalHolder_init") public func _bjs_OptionalHolder_init(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { @@ -12945,6 +13271,25 @@ func _$Animal_getIsCat(_ self: JSObject) throws(JSException) -> Bool { return Bool.bridgeJSLiftReturn(ret) } +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static") +fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -> Void +#else +fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static() -> Void { + return bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() +} + +func _$IdentityModeSupportImports_runJsIdentityModeSupportTests() throws(JSException) -> Void { + bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static() + if let error = _swift_js_take_exception() { + throw error + } +} + #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsTranslatePoint") fileprivate func bjs_jsTranslatePoint_extern(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index dd4362fc1..76ed6dea0 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -4067,6 +4067,151 @@ ], "swiftCallName" : "TextProcessor" }, + { + "constructor" : { + "abiName" : "bjs_IdentityTestSubject_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "IdentityTestSubject", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "currentValue", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "IdentityTestSubject" + }, + { + "constructor" : { + "abiName" : "bjs_RetainLeakSubject_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "tag", + "name" : "tag", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "RetainLeakSubject", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "tag", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "RetainLeakSubject" + }, + { + "constructor" : { + "abiName" : "bjs_ArrayIdentityElement_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "tag", + "name" : "tag", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "ArrayIdentityElement", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "tag", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "ArrayIdentityElement" + }, { "constructor" : { "abiName" : "bjs_OptionalHolder_init", @@ -13798,6 +13943,247 @@ } } }, + { + "abiName" : "bjs_getSharedSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getSharedSubject", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "IdentityTestSubject" + } + } + }, + { + "abiName" : "bjs_resetSharedSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetSharedSubject", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getRetainLeakSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getRetainLeakSubject", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "RetainLeakSubject" + } + } + }, + { + "abiName" : "bjs_resetRetainLeakSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetRetainLeakSubject", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getRetainLeakDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getRetainLeakDeinits", + "parameters" : [ + + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_resetRetainLeakDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetRetainLeakDeinits", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_setupArrayPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setupArrayPool", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getArrayPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getArrayPool", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "ArrayIdentityElement" + } + } + } + } + }, + { + "abiName" : "bjs_getArrayPoolElement", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getArrayPoolElement", + "parameters" : [ + { + "label" : "_", + "name" : "index", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "ArrayIdentityElement" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_getArrayPoolDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getArrayPoolDeinits", + "parameters" : [ + + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_resetArrayPoolDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetArrayPoolDeinits", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_clearArrayPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "clearArrayPool", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, { "abiName" : "bjs_roundTripPointerFields", "effects" : { @@ -19174,6 +19560,43 @@ } ] }, + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "IdentityModeSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "runJsIdentityModeSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ] + } + ] + }, { "functions" : [ { diff --git a/Tests/BridgeJSRuntimeTests/IdentityModeSupportTests.swift b/Tests/BridgeJSRuntimeTests/IdentityModeSupportTests.swift new file mode 100644 index 000000000..a7c41035e --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/IdentityModeSupportTests.swift @@ -0,0 +1,113 @@ +import XCTest +import JavaScriptKit + +@JSClass struct IdentityModeSupportImports { + @JSFunction static func runJsIdentityModeSupportTests() throws(JSException) +} + +final class IdentityModeSupportTests: XCTestCase { + func testRunJsIdentityModeSupportTests() throws { + try IdentityModeSupportImports.runJsIdentityModeSupportTests() + } +} + +@JS class IdentityTestSubject { + @JS var value: Int + + @JS init(value: Int) { + self.value = value + } + + @JS var currentValue: Int { value } +} + +nonisolated(unsafe) private var _sharedSubject: IdentityTestSubject? + +@JS func getSharedSubject() -> IdentityTestSubject { + if _sharedSubject == nil { + _sharedSubject = IdentityTestSubject(value: 42) + } + return _sharedSubject! +} + +@JS func resetSharedSubject() { + _sharedSubject = nil +} + +@JS class RetainLeakSubject { + nonisolated(unsafe) static var deinits: Int = 0 + + @JS var tag: Int + + @JS init(tag: Int) { + self.tag = tag + } + + deinit { + Self.deinits += 1 + } +} + +nonisolated(unsafe) private var _retainLeakSubject: RetainLeakSubject? + +@JS func getRetainLeakSubject() -> RetainLeakSubject { + if _retainLeakSubject == nil { + _retainLeakSubject = RetainLeakSubject(tag: 1) + } + return _retainLeakSubject! +} + +@JS func resetRetainLeakSubject() { + _retainLeakSubject = nil +} + +@JS func getRetainLeakDeinits() -> Int { + RetainLeakSubject.deinits +} + +@JS func resetRetainLeakDeinits() { + RetainLeakSubject.deinits = 0 +} + +// MARK: - Array identity tests + +@JS class ArrayIdentityElement { + nonisolated(unsafe) static var deinits: Int = 0 + + @JS var tag: Int + + @JS init(tag: Int) { + self.tag = tag + } + + deinit { + Self.deinits += 1 + } +} + +nonisolated(unsafe) private var _arrayPool: [ArrayIdentityElement] = [] + +@JS func setupArrayPool(_ count: Int) { + _arrayPool = (0.. [ArrayIdentityElement] { + return _arrayPool +} + +@JS func getArrayPoolElement(_ index: Int) -> ArrayIdentityElement? { + guard index >= 0, index < _arrayPool.count else { return nil } + return _arrayPool[index] +} + +@JS func getArrayPoolDeinits() -> Int { + ArrayIdentityElement.deinits +} + +@JS func resetArrayPoolDeinits() { + ArrayIdentityElement.deinits = 0 +} + +@JS func clearArrayPool() { + _arrayPool = [] +} diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs b/Tests/BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs new file mode 100644 index 000000000..a17a9b1c7 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs @@ -0,0 +1,239 @@ +// @ts-check + +import assert from "node:assert"; + +/** + * @returns {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Imports["IdentityModeSupportImports"]} + */ +export function getImports(importsContext) { + return { + runJsIdentityModeSupportTests: () => { + const exports = importsContext.getExports(); + if (!exports) { + throw new Error("No exports!?"); + } + runIdentityModeTests(exports); + }, + }; +} + +/** + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + */ +function runIdentityModeTests(exports) { + const identityMode = process.env.IDENTITY_MODE || undefined; + + testWrapperIdentity(exports, identityMode); + testCacheInvalidationOnRelease(exports, identityMode); + testDifferentClassesDontCollide(exports); + testRetainLeakOnCacheHit(exports, identityMode); + testArrayElementIdentity(exports, identityMode); + testArrayElementMatchesSingleGetter(exports, identityMode); + testArrayRetainLeak(exports, identityMode); +} + +/** + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + * @param {string | undefined} identityMode + */ +function testWrapperIdentity(exports, identityMode) { + exports.resetSharedSubject(); + const a = exports.getSharedSubject(); + const b = exports.getSharedSubject(); + + if (identityMode === "pointer") { + assert.strictEqual( + a, + b, + "In pointer mode, same Swift object should return identical JS wrapper", + ); + } else { + assert.notStrictEqual( + a, + b, + "In default mode, same Swift object should return different JS wrappers", + ); + } + + assert.equal(a.currentValue, 42); + assert.equal(b.currentValue, 42); + + a.release(); + if (a !== b) { + b.release(); + } + exports.resetSharedSubject(); +} + +/** + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + * @param {string | undefined} identityMode + */ +function testCacheInvalidationOnRelease(exports, identityMode) { + exports.resetSharedSubject(); + const first = exports.getSharedSubject(); + first.release(); + + exports.resetSharedSubject(); + const second = exports.getSharedSubject(); + + assert.notStrictEqual( + first, + second, + "After release + reset, should get a different wrapper", + ); + assert.equal(second.currentValue, 42); + + second.release(); + exports.resetSharedSubject(); +} + +/** + * Verifies that repeated boundary crossings of the same Swift object don't leak + * retain counts. In pointer mode, each cache hit triggers passRetained on the + * Swift side. Without the balancing deinit(pointer) call on cache hit, each + * crossing leaks +1 retain and the object is never deallocated. + * + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + * @param {string | undefined} identityMode + */ +function testRetainLeakOnCacheHit(exports, identityMode) { + if (identityMode !== "pointer") return; + + exports.resetRetainLeakDeinits(); + exports.resetRetainLeakSubject(); + + const wrappers = []; + for (let i = 0; i < 10; i++) { + wrappers.push(exports.getRetainLeakSubject()); + } + + for (let i = 1; i < wrappers.length; i++) { + assert.strictEqual( + wrappers[0], + wrappers[i], + "All should be the same cached wrapper", + ); + } + + wrappers[0].release(); + exports.resetRetainLeakSubject(); + + assert.strictEqual( + exports.getRetainLeakDeinits(), + 1, + "Object should be deallocated after release + reset. " + + "If deinits == 0, retain leak from unbalanced passRetained on cache hits.", + ); +} + +/** + * Verifies that elements at the same index across repeated array returns are === + * in pointer mode. Without pointer mode, they should be different wrappers. + * + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + * @param {string | undefined} identityMode + */ +function testArrayElementIdentity(exports, identityMode) { + if (identityMode !== "pointer") return; + + exports.setupArrayPool(10); + const arr1 = exports.getArrayPool(); + const arr2 = exports.getArrayPool(); + + assert.equal(arr1.length, 10, "First array should have 10 elements"); + assert.equal(arr2.length, 10, "Second array should have 10 elements"); + + for (let i = 0; i < 10; i++) { + assert.strictEqual( + arr1[i], + arr2[i], + `Array element at index ${i} should be === across calls in pointer mode`, + ); + assert.equal(arr1[i].tag, i, `Element ${i} should have correct tag`); + } + + for (const elem of arr1) { + elem.release(); + } + exports.clearArrayPool(); +} + +/** + * Verifies that an array element is === to the same object returned via + * a single-element getter. + * + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + * @param {string | undefined} identityMode + */ +function testArrayElementMatchesSingleGetter(exports, identityMode) { + if (identityMode !== "pointer") return; + + exports.setupArrayPool(5); + const arr = exports.getArrayPool(); + const single = exports.getArrayPoolElement(2); + + assert.strictEqual( + arr[2], + single, + "Array element and single getter should return the same wrapper in pointer mode", + ); + assert.equal(single.tag, 2); + + for (const elem of arr) { + elem.release(); + } + exports.clearArrayPool(); +} + +/** + * Verifies that returning an array of N objects M times doesn't leak retains. + * After releasing all wrappers and clearing the pool, all objects should be + * deallocated. + * + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + * @param {string | undefined} identityMode + */ +function testArrayRetainLeak(exports, identityMode) { + if (identityMode !== "pointer") return; + + exports.resetArrayPoolDeinits(); + exports.setupArrayPool(5); + + for (let round = 0; round < 10; round++) { + exports.getArrayPool(); + } + + const arr = exports.getArrayPool(); + for (const elem of arr) { + elem.release(); + } + + exports.clearArrayPool(); + + assert.strictEqual( + exports.getArrayPoolDeinits(), + 5, + "All 5 pool objects should be deallocated after release + clear. " + + "If deinits < 5, retain leak from unbalanced passRetained in array returns.", + ); +} + +/** + * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports + */ +function testDifferentClassesDontCollide(exports) { + const greeter = new exports.Greeter("IdentityTest"); + const subject = new exports.IdentityTestSubject(99); + + assert.notStrictEqual( + greeter, + subject, + "Instances of different classes should never be ===", + ); + assert.equal(greeter.name, "IdentityTest"); + assert.equal(subject.currentValue, 99); + + greeter.release(); + subject.release(); +} diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index 0af033226..a3a9048f7 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -14,12 +14,15 @@ import { getImports as getDefaultArgumentImports } from './BridgeJSRuntimeTests/ import { getImports as getJSClassSupportImports, JSClassWithArrayMembers } from './BridgeJSRuntimeTests/JavaScript/JSClassSupportTests.mjs'; import { getImports as getIntegerTypesSupportImports } from './BridgeJSRuntimeTests/JavaScript/IntegerTypesSupportTests.mjs'; import { getImports as getAsyncImportImports, runAsyncWorksTests } from './BridgeJSRuntimeTests/JavaScript/AsyncImportTests.mjs'; +import { getImports as getIdentityModeSupportImports } from './BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs'; /** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ export async function setupOptions(options, context) { Error.stackTraceLimit = 100; setupTestGlobals(globalThis); + const identityMode = process.env.IDENTITY_MODE || undefined; + class StaticBox { constructor(value) { this._value = value; @@ -43,6 +46,7 @@ export async function setupOptions(options, context) { return { ...options, + ...(identityMode ? { instantiateOptions: { identityMode } } : {}), getImports: (importsContext) => { return { "jsRoundTripVoid": () => { @@ -155,6 +159,7 @@ export async function setupOptions(options, context) { DefaultArgumentImports: getDefaultArgumentImports(importsContext), JSClassSupportImports: getJSClassSupportImports(importsContext), IntegerTypesSupportImports: getIntegerTypesSupportImports(importsContext), + IdentityModeSupportImports: getIdentityModeSupportImports(importsContext), }; }, addToCoreImports(importObject, importsContext) { From df960e6014c5b4aa2c28aee65bfba8e01100fc31 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 17 Apr 2026 11:25:40 +0200 Subject: [PATCH 05/14] fix: Restore FinalizationRegistry polyfill and clean up formatting noise Restore the no-op polyfill pattern for environments without FinalizationRegistry instead of null, matching the upstream convention. Remove finalizer parameter from makeFresh since the polyfill is always callable. Use has() guard before stale WeakRef cleanup. Remove formatting-only changes from instantiate.d.ts. --- .../Sources/BridgeJSLink/BridgeJSLink.swift | 18 ++- .../BridgeJSLinkTests/ArrayTypes.js | 18 ++- .../BridgeJSLinkTests/DefaultParameters.js | 18 ++- .../BridgeJSLinkTests/DictionaryTypes.js | 18 ++- .../BridgeJSLinkTests/EnumAssociatedValue.js | 18 ++- .../BridgeJSLinkTests/EnumNamespace.Global.js | 18 ++- .../BridgeJSLinkTests/EnumNamespace.js | 18 ++- .../BridgeJSLinkTests/JSValue.js | 18 ++- .../BridgeJSLinkTests/MixedGlobal.js | 18 ++- .../BridgeJSLinkTests/MixedModules.js | 18 ++- .../BridgeJSLinkTests/MixedPrivate.js | 18 ++- .../BridgeJSLinkTests/Namespaces.Global.js | 18 ++- .../BridgeJSLinkTests/Namespaces.js | 18 ++- .../BridgeJSLinkTests/Optionals.js | 18 ++- .../BridgeJSLinkTests/PropertyTypes.js | 18 ++- .../BridgeJSLinkTests/Protocol.js | 18 ++- .../BridgeJSLinkTests/ProtocolInClosure.js | 18 ++- .../StaticFunctions.Global.js | 18 ++- .../BridgeJSLinkTests/StaticFunctions.js | 18 ++- .../StaticProperties.Global.js | 18 ++- .../BridgeJSLinkTests/StaticProperties.js | 18 ++- .../BridgeJSLinkTests/SwiftClass.js | 18 ++- .../BridgeJSLinkTests/SwiftClosure.js | 18 ++- .../BridgeJSLinkTests/SwiftStruct.js | 18 ++- .../PackageToJS/Templates/instantiate.d.ts | 110 ++++++++---------- 25 files changed, 240 insertions(+), 302 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index e9cde70f5..717c13c5c 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -74,7 +74,7 @@ public struct BridgeJSLink { output += lifetimeTrackingClassJs + "\n" } output += """ - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { """ if enableLifetimeTracking { @@ -92,9 +92,9 @@ public struct BridgeJSLink { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; """ if enableLifetimeTracking { @@ -103,9 +103,7 @@ public struct BridgeJSLink { output += """ obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -113,7 +111,7 @@ public struct BridgeJSLink { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -121,11 +119,11 @@ public struct BridgeJSLink { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -140,7 +138,7 @@ public struct BridgeJSLink { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 16ce6f57f..f89c0e10b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -345,7 +345,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -357,14 +357,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -372,7 +370,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -380,11 +378,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -393,7 +391,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 92aee1923..336784fb7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -276,7 +276,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -288,14 +288,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -303,7 +301,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -311,11 +309,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -324,7 +322,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 2001e8317..f11c1cdd8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -285,7 +285,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -297,14 +297,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -312,7 +310,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -320,11 +318,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -333,7 +331,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 09f2cb7d0..3fa45ef40 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -952,7 +952,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -964,14 +964,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -979,7 +977,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -987,11 +985,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -1000,7 +998,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 57d3474ef..7b21cd65d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -268,7 +268,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -280,14 +280,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -295,7 +293,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -303,11 +301,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -316,7 +314,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 958cf0eea..ae42a0f26 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -249,7 +249,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -261,14 +261,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -276,7 +274,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -284,11 +282,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -297,7 +295,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index d5ea77cdd..2239dcab2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -339,7 +339,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -351,14 +351,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -366,7 +364,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -374,11 +372,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -387,7 +385,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 08682d8f8..f6f722c12 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -212,7 +212,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -224,14 +224,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -239,7 +237,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -247,11 +245,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -260,7 +258,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 9d8ee95f3..5e7d75d83 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -220,7 +220,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -232,14 +232,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -247,7 +245,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -255,11 +253,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -268,7 +266,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index fd889531a..98415fa7f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -212,7 +212,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -224,14 +224,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -239,7 +237,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -247,11 +245,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -260,7 +258,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 2942770ac..55647f15a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -224,7 +224,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -236,14 +236,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -251,7 +249,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -259,11 +257,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -272,7 +270,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index 332f9599d..f6cce62a3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -224,7 +224,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -236,14 +236,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -251,7 +249,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -259,11 +257,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -272,7 +270,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index a0577033c..29c57aed0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -468,7 +468,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -480,14 +480,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -495,7 +493,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -503,11 +501,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -516,7 +514,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 240065d49..0c5c474f2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -212,7 +212,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -224,14 +224,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -239,7 +237,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -247,11 +245,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -260,7 +258,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 0f41bb817..c24822037 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -572,7 +572,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -584,14 +584,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -599,7 +597,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -607,11 +605,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -620,7 +618,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js index 4fbbea982..7ac906b8b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js @@ -358,7 +358,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -370,14 +370,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -385,7 +383,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -393,11 +391,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -406,7 +404,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 58c31e8e1..2ba1ef696 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -256,7 +256,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -268,14 +268,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -283,7 +281,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -291,11 +289,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -304,7 +302,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 74ebb41dd..8b2299a60 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -256,7 +256,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -268,14 +268,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -283,7 +281,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -291,11 +289,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -304,7 +302,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 9224ec13d..90c09bf01 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -217,7 +217,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -229,14 +229,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -244,7 +242,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -252,11 +250,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -265,7 +263,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index 4e6b8e81c..f45a58b7c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -217,7 +217,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -229,14 +229,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -244,7 +242,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -252,11 +250,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -265,7 +263,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 2b268c50d..7be26f087 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -240,7 +240,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -252,14 +252,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -267,7 +265,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -275,11 +273,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -288,7 +286,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index b4ad8ea58..ac4ee8dad 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -899,7 +899,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -911,14 +911,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -926,7 +924,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -934,11 +932,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -947,7 +945,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index 84330e359..4cde888c7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -481,7 +481,7 @@ export async function createInstantiator(options, swift) { /** @param {WebAssembly.Instance} instance */ createExports: (instance) => { const js = swift.memory.heap; - const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? null : new FinalizationRegistry((state) => { + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.hasReleased) { return; } @@ -493,14 +493,12 @@ export async function createInstantiator(options, swift) { /// Represents a Swift heap object like a class instance or an actor instance. class SwiftHeapObject { static __wrap(pointer, deinit, prototype, identityCache) { - const makeFresh = (identityMap, finalizer) => { + const makeFresh = (identityMap) => { const obj = Object.create(prototype); - const state = { pointer, deinit, hasReleased: false, identityMap, finalizer }; + const state = { pointer, deinit, hasReleased: false, identityMap }; obj.pointer = pointer; obj.__swiftHeapObjectState = state; - if (finalizer) { - finalizer.register(obj, state, state); - } + swiftHeapObjectFinalizationRegistry.register(obj, state, state); if (identityMap) { identityMap.set(pointer, new WeakRef(obj)); } @@ -508,7 +506,7 @@ export async function createInstantiator(options, swift) { }; if (!shouldUseIdentityMap) { - return makeFresh(null, swiftHeapObjectFinalizationRegistry); + return makeFresh(null); } const cached = identityCache.get(pointer)?.deref(); @@ -516,11 +514,11 @@ export async function createInstantiator(options, swift) { deinit(pointer); return cached; } - if (!cached) { + if (identityCache.has(pointer)) { identityCache.delete(pointer); } - return makeFresh(identityCache, swiftHeapObjectFinalizationRegistry); + return makeFresh(identityCache); } release() { @@ -529,7 +527,7 @@ export async function createInstantiator(options, swift) { return; } state.hasReleased = true; - state.finalizer?.unregister(state); + swiftHeapObjectFinalizationRegistry.unregister(state); state.identityMap?.delete(state.pointer); state.deinit(state.pointer); } diff --git a/Plugins/PackageToJS/Templates/instantiate.d.ts b/Plugins/PackageToJS/Templates/instantiate.d.ts index ca515b345..0caf328dc 100644 --- a/Plugins/PackageToJS/Templates/instantiate.d.ts +++ b/Plugins/PackageToJS/Templates/instantiate.d.ts @@ -6,8 +6,8 @@ import type { SwiftRuntimeThreadChannel } from "./runtime.js"; export type { Imports, Exports } from "./bridge-js.js"; import type { Imports, Exports } from "./bridge-js.js"; /* #else */ -export type Imports = {}; -export type Exports = {}; +export type Imports = {} +export type Exports = {} /* #endif */ /** @@ -20,50 +20,45 @@ export declare const MODULE_PATH: string; * The type of the WebAssembly memory imported by the module */ export declare const MEMORY_TYPE: { - initial: number; - maximum: number; - shared: boolean; -}; + initial: number, + maximum: number, + shared: boolean +} /* #endif */ export interface WASI { /** * The WASI Preview 1 import object */ - wasiImport: WebAssembly.ModuleImports; + wasiImport: WebAssembly.ModuleImports /** * Initialize the WASI reactor instance * * @param instance - The instance of the WebAssembly module */ - initialize(instance: WebAssembly.Instance): void; + initialize(instance: WebAssembly.Instance): void /** * Set a new instance of the WebAssembly module to the WASI context * Typically used when instantiating a WebAssembly module for a thread * * @param instance - The instance of the WebAssembly module */ - setInstance(instance: WebAssembly.Instance): void; + setInstance(instance: WebAssembly.Instance): void /** * Extract a file from the WASI filesystem * * @param path - The path to the file to extract * @returns The data of the file if it was extracted, undefined otherwise */ - extractFile?(path: string): Uint8Array | undefined; + extractFile?(path: string): Uint8Array | undefined } export type SwiftRuntime = { - UnsafeEventLoopYield: { [Symbol.hasInstance]: (value: unknown) => boolean }; + UnsafeEventLoopYield: { [Symbol.hasInstance]: (value: unknown) => boolean } main(): void; startThread(tid: number, startArg: number): void; -}; +} -export type ModuleSource = - | WebAssembly.Module - | ArrayBufferView - | ArrayBuffer - | Response - | PromiseLike; +export type ModuleSource = WebAssembly.Module | ArrayBufferView | ArrayBuffer | Response | PromiseLike /** * The options for instantiating a WebAssembly module @@ -73,44 +68,40 @@ export type InstantiateOptions = { * The WebAssembly namespace to use for instantiation. * Defaults to the globalThis.WebAssembly object. */ - WebAssembly?: typeof globalThis.WebAssembly; + WebAssembly?: typeof globalThis.WebAssembly, /** * The WebAssembly module to instantiate */ - module: ModuleSource; - /* #if HAS_IMPORTS */ + module: ModuleSource, +/* #if HAS_IMPORTS */ /** * The function to get the imports provided by the embedder */ getImports: (importsContext: { - getInstance: () => WebAssembly.Instance | null; - getExports: () => Exports | null; - _swift: SwiftRuntime; - }) => Imports; - /* #endif */ - /* #if IS_WASI */ + getInstance: () => WebAssembly.Instance | null, + getExports: () => Exports | null, + _swift: SwiftRuntime, + }) => Imports, +/* #endif */ +/* #if IS_WASI */ /** * The WASI implementation to use */ - wasi: WASI; - /* #endif */ - /* #if USE_SHARED_MEMORY */ + wasi: WASI, +/* #endif */ +/* #if USE_SHARED_MEMORY */ /** * The WebAssembly memory to use (must be 'shared') */ - memory: WebAssembly.Memory; + memory: WebAssembly.Memory /** * The thread channel is a set of functions that are used to communicate * between the main thread and the worker thread. */ threadChannel: SwiftRuntimeThreadChannel & { - spawnThread: ( - module: WebAssembly.Module, - memory: WebAssembly.Memory, - startArg: any, - ) => number; - }; - /* #endif */ + spawnThread: (module: WebAssembly.Module, memory: WebAssembly.Memory, startArg: any) => number; + } +/* #endif */ /** * Add imports to the WebAssembly import object * @param imports - The imports to add @@ -119,11 +110,11 @@ export type InstantiateOptions = { addToCoreImports?: ( imports: WebAssembly.Imports, context: { - getInstance: () => WebAssembly.Instance | null; - getExports: () => Exports | null; - _swift: SwiftRuntime; - }, - ) => void; + getInstance: () => WebAssembly.Instance | null, + getExports: () => Exports | null, + _swift: SwiftRuntime, + } + ) => void /** * Instrument the WebAssembly instance @@ -135,36 +126,31 @@ export type InstantiateOptions = { instrumentInstance?: ( instance: WebAssembly.Instance, context: { - _swift: SwiftRuntime; - }, - ) => WebAssembly.Instance; + _swift: SwiftRuntime + } + ) => WebAssembly.Instance /** * Controls whether exported Swift class instances use pointer-based identity mapping. * When set to "pointer", the same Swift heap pointer will always return the same JS wrapper object. - * Defaults to "none". */ - identityMode?: "none" | "pointer"; -}; + identityMode?: "none" | "pointer" +} /** * Instantiate the given WebAssembly module */ export declare function instantiate(options: InstantiateOptions): Promise<{ - instance: WebAssembly.Instance; - swift: SwiftRuntime; - exports: Exports; -}>; + instance: WebAssembly.Instance, + swift: SwiftRuntime, + exports: Exports +}> /** * Instantiate the given WebAssembly module for a thread */ -export declare function instantiateForThread( - tid: number, - startArg: number, - options: InstantiateOptions, -): Promise<{ - instance: WebAssembly.Instance; - swift: SwiftRuntime; - exports: Exports; -}>; +export declare function instantiateForThread(tid: number, startArg: number, options: InstantiateOptions): Promise<{ + instance: WebAssembly.Instance, + swift: SwiftRuntime, + exports: Exports +}> From 89deed08fff50972f0dca83bc566a8f6d912bfee Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 17 Apr 2026 11:43:51 +0200 Subject: [PATCH 06/14] refactor: Move identityMode to bridge-js.config.json following exposeToGlobal pattern Add identityMode field to BridgeJSConfig, flow through SwiftToSkeleton and ExportedSkeleton to BridgeJSLink. Generated JS uses config value as default with runtime option as override via nullish coalescing. Create dedicated BridgeJSIdentityTests target with identityMode: pointer in its bridge-js.config.json. Remove IDENTITY_MODE env var, instantiateOptions spread from prelude.mjs, and unittest-pointer Makefile target. Identity tests now run as part of the normal test suite. --- Makefile | 12 - Package.swift | 12 + Package@swift-6.1.swift | 12 + .../BridgeJS/Sources/BridgeJSCore/Misc.swift | 17 +- .../BridgeJSCore/SwiftToSkeleton.swift | 6 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 3 +- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 11 +- .../Sources/BridgeJSTool/BridgeJSTool.swift | 3 +- .../BridgeJSToolTests/BridgeJSLinkTests.swift | 2 +- .../BridgeJSLinkTests/ArrayTypes.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/Async.js | 2 +- .../BridgeJSLinkTests/AsyncImport.js | 2 +- .../BridgeJSLinkTests/AsyncStaticImport.js | 2 +- .../BridgeJSLinkTests/DefaultParameters.js | 2 +- .../BridgeJSLinkTests/DictionaryTypes.js | 2 +- .../BridgeJSLinkTests/EnumAssociatedValue.js | 2 +- .../BridgeJSLinkTests/EnumCase.js | 2 +- .../BridgeJSLinkTests/EnumNamespace.Global.js | 2 +- .../BridgeJSLinkTests/EnumNamespace.js | 2 +- .../BridgeJSLinkTests/EnumRawType.js | 2 +- .../BridgeJSLinkTests/FixedWidthIntegers.js | 2 +- .../BridgeJSLinkTests/GlobalGetter.js | 2 +- .../BridgeJSLinkTests/GlobalThisImports.js | 2 +- .../BridgeJSLinkTests/ImportArray.js | 2 +- .../ImportedTypeInExportedInterface.js | 2 +- .../BridgeJSLinkTests/InvalidPropertyNames.js | 2 +- .../BridgeJSLinkTests/JSClass.js | 2 +- .../JSClassStaticFunctions.js | 2 +- .../BridgeJSLinkTests/JSValue.js | 2 +- .../BridgeJSLinkTests/MixedGlobal.js | 2 +- .../BridgeJSLinkTests/MixedModules.js | 2 +- .../BridgeJSLinkTests/MixedPrivate.js | 2 +- .../BridgeJSLinkTests/Namespaces.Global.js | 2 +- .../BridgeJSLinkTests/Namespaces.js | 2 +- .../BridgeJSLinkTests/Optionals.js | 2 +- .../BridgeJSLinkTests/PrimitiveParameters.js | 2 +- .../BridgeJSLinkTests/PrimitiveReturn.js | 2 +- .../BridgeJSLinkTests/PropertyTypes.js | 2 +- .../BridgeJSLinkTests/Protocol.js | 2 +- .../BridgeJSLinkTests/ProtocolInClosure.js | 2 +- .../StaticFunctions.Global.js | 2 +- .../BridgeJSLinkTests/StaticFunctions.js | 2 +- .../StaticProperties.Global.js | 2 +- .../BridgeJSLinkTests/StaticProperties.js | 2 +- .../BridgeJSLinkTests/StringParameter.js | 2 +- .../BridgeJSLinkTests/StringReturn.js | 2 +- .../BridgeJSLinkTests/SwiftClass.js | 2 +- .../BridgeJSLinkTests/SwiftClosure.js | 2 +- .../BridgeJSLinkTests/SwiftClosureImports.js | 2 +- .../BridgeJSLinkTests/SwiftStruct.js | 2 +- .../BridgeJSLinkTests/SwiftStructImports.js | 2 +- .../__Snapshots__/BridgeJSLinkTests/Throws.js | 2 +- .../BridgeJSLinkTests/UnsafePointer.js | 2 +- .../VoidParameterVoidReturn.js | 2 +- .../Generated/BridgeJS.swift | 14203 +++++++++++ .../Generated/JavaScript/BridgeJS.json | 20907 ++++++++++++++++ .../IdentityModeTests.swift} | 10 +- .../JavaScript/IdentityModeTests.mjs} | 111 +- .../bridge-js.config.json | 3 + .../Generated/BridgeJS.swift | 345 - .../Generated/JavaScript/BridgeJS.json | 423 - Tests/prelude.mjs | 6 +- 62 files changed, 35259 insertions(+), 917 deletions(-) create mode 100644 Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift create mode 100644 Tests/BridgeJSIdentityTests/Generated/JavaScript/BridgeJS.json rename Tests/{BridgeJSRuntimeTests/IdentityModeSupportTests.swift => BridgeJSIdentityTests/IdentityModeTests.swift} (87%) rename Tests/{BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs => BridgeJSIdentityTests/JavaScript/IdentityModeTests.mjs} (58%) create mode 100644 Tests/BridgeJSIdentityTests/bridge-js.config.json diff --git a/Makefile b/Makefile index df9aeb010..270eb9b36 100644 --- a/Makefile +++ b/Makefile @@ -21,18 +21,6 @@ unittest: --disable-sandbox \ js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc -.PHONY: unittest-pointer -unittest-pointer: - @echo Running unit tests with identityMode=pointer - @test -n "$(SWIFT_SDK_ID)" || { \ - echo "SWIFT_SDK_ID is not set. Run 'swift sdk list' and pass a matching SDK, e.g. 'make unittest-pointer SWIFT_SDK_ID='."; \ - exit 2; \ - } - IDENTITY_MODE=pointer swift package --swift-sdk "$(SWIFT_SDK_ID)" \ - $(TRACING_ARGS) \ - --disable-sandbox \ - js test --prelude ./Tests/prelude.mjs -Xnode --expose-gc - .PHONY: regenerate_swiftpm_resources regenerate_swiftpm_resources: npm run build diff --git a/Package.swift b/Package.swift index 820524177..3d0f1e943 100644 --- a/Package.swift +++ b/Package.swift @@ -217,5 +217,17 @@ let package = Package( ], linkerSettings: testingLinkerFlags ), + .testTarget( + name: "BridgeJSIdentityTests", + dependencies: ["JavaScriptKit", "JavaScriptEventLoop"], + exclude: [ + "bridge-js.config.json", + "Generated/JavaScript", + ], + swiftSettings: [ + .enableExperimentalFeature("Extern") + ], + linkerSettings: testingLinkerFlags + ), ] ) diff --git a/Package@swift-6.1.swift b/Package@swift-6.1.swift index 60adb7a5f..fe98ec529 100644 --- a/Package@swift-6.1.swift +++ b/Package@swift-6.1.swift @@ -206,5 +206,17 @@ let package = Package( ], linkerSettings: testingLinkerFlags ), + .testTarget( + name: "BridgeJSIdentityTests", + dependencies: ["JavaScriptKit", "JavaScriptEventLoop"], + exclude: [ + "bridge-js.config.json", + "Generated/JavaScript", + ], + swiftSettings: [ + .enableExperimentalFeature("Extern") + ], + linkerSettings: testingLinkerFlags + ), ] ) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift index 06fb422a9..37040d7a6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/Misc.swift @@ -342,20 +342,32 @@ public struct BridgeJSConfig: Codable { /// Default: `false` public var exposeToGlobal: Bool - public init(tools: [String: String]? = nil, exposeToGlobal: Bool = false) { + /// The identity mode to use for exported Swift heap objects. + /// + /// When `"pointer"`, Swift heap objects are tracked by pointer identity, + /// enabling identity-based caching. When `"none"` or `nil`, no identity + /// tracking is performed. + /// + /// Default: `nil` (treated as `"none"`) + public var identityMode: String? + + public init(tools: [String: String]? = nil, exposeToGlobal: Bool = false, identityMode: String? = nil) { self.tools = tools self.exposeToGlobal = exposeToGlobal + self.identityMode = identityMode } enum CodingKeys: String, CodingKey { case tools case exposeToGlobal + case identityMode } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) tools = try container.decodeIfPresent([String: String].self, forKey: .tools) exposeToGlobal = try container.decodeIfPresent(Bool.self, forKey: .exposeToGlobal) ?? false + identityMode = try container.decodeIfPresent(String.self, forKey: .identityMode) } /// Load the configuration file from the SwiftPM package target directory. @@ -398,7 +410,8 @@ public struct BridgeJSConfig: Codable { func merging(overrides: BridgeJSConfig) -> BridgeJSConfig { return BridgeJSConfig( tools: (tools ?? [:]).merging(overrides.tools ?? [:], uniquingKeysWith: { $1 }), - exposeToGlobal: overrides.exposeToGlobal + exposeToGlobal: overrides.exposeToGlobal, + identityMode: overrides.identityMode ?? identityMode ) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 7b7c6ca30..369c75e72 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -16,14 +16,16 @@ public final class SwiftToSkeleton { public let progress: ProgressReporting public let moduleName: String public let exposeToGlobal: Bool + public let identityMode: String? private var sourceFiles: [(sourceFile: SourceFileSyntax, inputFilePath: String)] = [] let typeDeclResolver: TypeDeclResolver - public init(progress: ProgressReporting, moduleName: String, exposeToGlobal: Bool) { + public init(progress: ProgressReporting, moduleName: String, exposeToGlobal: Bool, identityMode: String? = nil) { self.progress = progress self.moduleName = moduleName self.exposeToGlobal = exposeToGlobal + self.identityMode = identityMode self.typeDeclResolver = TypeDeclResolver() // Index known types provided by JavaScriptKit @@ -42,7 +44,7 @@ public final class SwiftToSkeleton { public func finalize() throws -> BridgeJSSkeleton { var perSourceErrors: [(inputFilePath: String, errors: [DiagnosticError])] = [] var importedFiles: [ImportedFileSkeleton] = [] - var exported = ExportedSkeleton(functions: [], classes: [], enums: [], exposeToGlobal: exposeToGlobal) + var exported = ExportedSkeleton(functions: [], classes: [], enums: [], exposeToGlobal: exposeToGlobal, identityMode: identityMode) var exportCollectors: [ExportSwiftAPICollector] = [] for (sourceFile, inputFilePath) in sourceFiles { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 717c13c5c..50d2a4317 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -983,7 +983,8 @@ public struct BridgeJSLink { try printer.indent { printer.write(lines: generateVariableDeclarations()) - printer.write("const identityMode = options.identityMode === \"pointer\" ? \"pointer\" : \"none\";") + let configIdentityMode = skeletons.compactMap(\.exported).first?.identityMode ?? "none" + printer.write("const identityMode = options.identityMode ?? \"\(configIdentityMode)\";") printer.write( "const shouldUseIdentityMap = identityMode === \"pointer\" && typeof WeakRef !== \"undefined\" && typeof FinalizationRegistry !== \"undefined\";" ) diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index c5672c79c..f77b66043 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -890,13 +890,20 @@ public struct ExportedSkeleton: Codable { /// through the exports object. public var exposeToGlobal: Bool + /// The identity mode for exported Swift heap objects. + /// + /// When `"pointer"`, Swift heap objects are tracked by pointer identity. + /// When `"none"` or `nil`, no identity tracking is performed. + public var identityMode: String? + public init( functions: [ExportedFunction], classes: [ExportedClass], enums: [ExportedEnum], structs: [ExportedStruct] = [], protocols: [ExportedProtocol] = [], - exposeToGlobal: Bool + exposeToGlobal: Bool, + identityMode: String? = nil ) { self.functions = functions self.classes = classes @@ -904,6 +911,7 @@ public struct ExportedSkeleton: Codable { self.structs = structs self.protocols = protocols self.exposeToGlobal = exposeToGlobal + self.identityMode = identityMode } public mutating func append(_ other: ExportedSkeleton) { @@ -913,6 +921,7 @@ public struct ExportedSkeleton: Codable { self.structs.append(contentsOf: other.structs) self.protocols.append(contentsOf: other.protocols) assert(self.exposeToGlobal == other.exposeToGlobal) + assert(self.identityMode == other.identityMode) } public var isEmpty: Bool { diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index a71aaee44..3e3f27ea1 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -165,7 +165,8 @@ import BridgeJSUtilities let swiftToSkeleton = SwiftToSkeleton( progress: progress, moduleName: moduleName, - exposeToGlobal: config.exposeToGlobal + exposeToGlobal: config.exposeToGlobal, + identityMode: config.identityMode ) for inputFile in inputFiles.sorted() { try withSpan("Parsing \(inputFile)") { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 877afe323..8906cdeb3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -124,7 +124,7 @@ import Testing #expect(outputDts.contains("identityMode?: \"none\" | \"pointer\";")) #expect( - outputJs.contains("const identityMode = options.identityMode === \"pointer\" ? \"pointer\" : \"none\";") + outputJs.contains("const identityMode = options.identityMode ?? \"none\";") ) #expect( outputJs.contains( diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index f89c0e10b..32d9126fc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -43,7 +43,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index f5b100887..c3a2a2e53 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js index c28de41ea..8f2a26d9b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; function __bjs_jsValueLower(value) { let kind; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js index 87e957112..4dec1f812 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; function __bjs_jsValueLower(value) { let kind; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 336784fb7..3064e18a9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -36,7 +36,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createConfigHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index f11c1cdd8..100550c7e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createCountersHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 3fa45ef40..375493923 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -111,7 +111,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index 4b1afa60d..481a198db 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -54,7 +54,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 7b21cd65d..21dbd3c55 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -74,7 +74,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index ae42a0f26..7e7627d32 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -55,7 +55,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 2e3abb637..f47ae00ce 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -105,7 +105,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js index 32ee37347..18cb1d34d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index ec1237f66..4f7732d63 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index be7deb1ea..aff235d10 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index ecb8cb821..9971930a4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 4dc2da4f5..041822b7f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createFooContainerHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index 846e08788..b49a8922c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 622285468..56b7a70e6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index 19b2aa1d6..03b1a3cb8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 2239dcab2..1626f7c50 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; function __bjs_jsValueLower(value) { let kind; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index f6f722c12..4dabe1466 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 5e7d75d83..35133ca32 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 98415fa7f..81a878053 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 55647f15a..f18eaf4d5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index f6cce62a3..ef0f69b5e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 29c57aed0..c01c54626 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index 21ae7a2b1..abb362ce7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index 95b23250a..a2f0d3e4c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 0c5c474f2..dc3416dc8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index c24822037..f0d2a2a06 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -54,7 +54,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createResultValuesHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js index 7ac906b8b..2d98e6115 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 2ba1ef696..2bdc3596a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -41,7 +41,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createAPIResultValuesHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 8b2299a60..d497f84f0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -41,7 +41,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createAPIResultValuesHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 90c09bf01..d1090525d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -35,7 +35,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index f45a58b7c..81e15106d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -35,7 +35,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index 1ca98a411..239206e95 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 14c34605b..2f8d3dd22 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 7be26f087..47b6bc560 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index ac4ee8dad..7020ab4ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -60,7 +60,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index ac13ec16c..2724a6322 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index 4cde888c7..525093444 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -35,7 +35,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createDataPointHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index f73ecfc2d..092a49f9b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index acd2d4566..5b07dae16 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index f61606e02..181cc29a9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointerFieldsHelpers = () => ({ lower: (value) => { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index d2b58d2da..901732e48 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -30,7 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode === "pointer" ? "pointer" : "none"; + const identityMode = options.identityMode ?? "none"; const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { diff --git a/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift b/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift new file mode 100644 index 000000000..9a92a00b5 --- /dev/null +++ b/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift @@ -0,0 +1,14203 @@ +// bridge-js: skip +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +@_spi(BridgeJS) import JavaScriptKit + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si { + static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(callbackValue, param0Value) + return Int.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (HttpStatus) -> Int { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (HttpStatus) -> Int) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(HttpStatus) -> Int>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(HttpStatus.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP { + static func bridgeJSLift(_ callbackId: Int32) -> (any DataProcessor) -> any DataProcessor { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0ObjectId = (param0 as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP(callbackValue, param0ObjectId) + return AnyDataProcessor.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (any DataProcessor) -> any DataProcessor { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (any DataProcessor) -> any DataProcessor) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(any DataProcessor) -> any DataProcessor>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(AnyDataProcessor.bridgeJSLiftParameter(param0)) + return (result as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests13DataProcessorP_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (any DataProcessor) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0ObjectId = (param0 as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS(callbackValue, param0ObjectId) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (any DataProcessor) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (any DataProcessor) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(any DataProcessor) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(AnyDataProcessor.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(callback, param0Bytes, param0Length) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let ret0 = param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(callbackValue, param0Bytes, param0Length) + return ret + } + let ret = ret0 + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Theme) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Theme) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Theme) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(callback, param0Bytes, param0Length) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb { + static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let ret0 = param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(callbackValue, param0Bytes, param0Length) + return ret + } + let ret = ret0 + return Bool.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Theme) -> Bool { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Theme) -> Bool) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Theme) -> Bool>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Greeter) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Pointer = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(callbackValue, param0Pointer) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Greeter) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Greeter) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Greeter) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Greeter.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC { + static func bridgeJSLift(_ callbackId: Int32) -> (JSObject) -> JSObject { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(callbackValue, param0Value) + return JSObject.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (JSObject) -> JSObject { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (JSObject) -> JSObject) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(JSObject) -> JSObject>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(JSObject.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0CaseId = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(callbackValue, param0CaseId) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (APIResult) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (APIResult) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(APIResult) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(APIResult.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(callbackValue, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Direction) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Direction) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Direction) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Direction.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb { + static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(callbackValue, param0Value) + return Bool.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Direction) -> Bool { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Direction) -> Bool) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Direction) -> Bool>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Direction.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> UnsafeMutableRawPointer { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(callback, param0Bytes, param0Length) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC { + static func bridgeJSLift(_ callbackId: Int32) -> (String) -> Greeter { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let ret0 = param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(callbackValue, param0Bytes, param0Length) + return ret + } + let ret = ret0 + return Greeter.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (String) -> Greeter { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (String) -> Greeter) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(String) -> Greeter>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(callback, param0Bytes, param0Length) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let ret0 = param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(callbackValue, param0Bytes, param0Length) + return ret + } + let ret = ret0 + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (String) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (String) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(String) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(_ callback: Int32, _ param0: Float64) -> Float64 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(_ callback: Int32, _ param0: Float64) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSd_Sd { + static func bridgeJSLift(_ callbackId: Int32) -> (Double) -> Double { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(callbackValue, param0Value) + return Double.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Double) -> Double { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Double) -> Double) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ param0: Float64) -> Float64 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Double) -> Double>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Double.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ callback: Int32, _ param0: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2: Float64) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ callback: Int32, _ param0: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ callback: Int32, _ param0: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2: Float64) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(callback, param0, param1Bytes, param1Length, param2) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSSSd_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Int, String, Double) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] (param0, param1, param2) in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + let ret0 = param1.bridgeJSWithLoweredParameter { (param1Bytes, param1Length) in + let param2Value = param2.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(callbackValue, param0Value, param1Bytes, param1Length, param2Value) + return ret + } + let ret = ret0 + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Int, String, Double) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int, String, Double) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2: Float64) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int, String, Double) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Int.bridgeJSLiftParameter(param0), String.bridgeJSLiftParameter(param1Bytes, param1Length), Double.bridgeJSLiftParameter(param2)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(callback, param0, param1, param2) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSiSi_Si { + static func bridgeJSLift(_ callbackId: Int32) -> (Int, Int, Int) -> Int { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] (param0, param1, param2) in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + let param1Value = param1.bridgeJSLowerParameter() + let param2Value = param2.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(callbackValue, param0Value, param1Value, param2Value) + return Int.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Int, Int, Int) -> Int { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int, Int, Int) -> Int) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int, Int, Int) -> Int>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Int.bridgeJSLiftParameter(param0), Int.bridgeJSLiftParameter(param1), Int.bridgeJSLiftParameter(param2)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(callback, param0, param1) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSi_Si { + static func bridgeJSLift(_ callbackId: Int32) -> (Int, Int) -> Int { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] (param0, param1) in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + let param1Value = param1.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(callbackValue, param0Value, param1Value) + return Int.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Int, Int) -> Int { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int, Int) -> Int) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32, _ param1: Int32) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int, Int) -> Int>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Int.bridgeJSLiftParameter(param0), Int.bridgeJSLiftParameter(param1)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_Si { + static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(callbackValue, param0Value) + return Int.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Int) -> Int { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int) -> Int) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int) -> Int>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Int.bridgeJSLiftParameter(param0)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(_ callback: Int32, _ param0: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(_ callback: Int32, _ param0: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ callback: Int32, _ param0: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_y { + static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(callbackValue, param0Value) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Int) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(Int.bridgeJSLiftParameter(param0)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0ObjectId: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0ObjectId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0ObjectId: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(callback, param0IsSome, param0ObjectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq13DataProcessorP_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let (param0IsSome, param0ObjectId): (Int32, Int32) + if let param0 { + (param0IsSome, param0ObjectId) = (1, (param0 as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) + } else { + (param0IsSome, param0ObjectId) = (0, 0) + } + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS(callbackValue, param0IsSome, param0ObjectId) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(callback, param0IsSome, param0Bytes, param0Length) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let ret0 = param0.bridgeJSWithLoweredParameter { (param0IsSome, param0Bytes, param0Length) in + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(callbackValue, param0IsSome, param0Bytes, param0Length) + return ret + } + let ret = ret0 + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(callback, param0IsSome, param0Pointer) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let (param0IsSome, param0Pointer) = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(callbackValue, param0IsSome, param0Pointer) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(callback, param0IsSome, param0Pointer) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC { + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let (param0IsSome, param0Pointer) = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(callbackValue, param0IsSome, param0Pointer) + return Optional.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Optional) -> Optional { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> Optional) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> Optional>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(callback, param0IsSome, param0CaseId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let (param0IsSome, param0CaseId) = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(callbackValue, param0IsSome, param0CaseId) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(callback, param0IsSome, param0Value) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(callbackValue, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(callback, param0IsSome, param0Bytes, param0Length) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let ret0 = param0.bridgeJSWithLoweredParameter { (param0IsSome, param0Bytes, param0Length) in + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(callbackValue, param0IsSome, param0Bytes, param0Length) + return ret + } + let ret = ret0 + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(callback, param0IsSome, param0Value) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS { + static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(callbackValue, param0IsSome, param0Value) + return String.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (Optional) -> String { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(callback, param0Bytes, param0Length) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestss11FeatureFlagO_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending FeatureFlag) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y(callbackValue, param0Bytes, param0Length) + } + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending FeatureFlag) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending FeatureFlag) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending FeatureFlag) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(FeatureFlag.bridgeJSLiftParameter(param0Bytes, param0Length)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(_ callback: Int32, _ param0: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(_ callback: Int32, _ param0: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y(_ callback: Int32, _ param0: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestss11WeatherDataC_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending WeatherData) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y(callbackValue, param0Value) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending WeatherData) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending WeatherData) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending WeatherData) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(WeatherData.bridgeJSLiftParameter(param0)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(_ callback: Int32, _ param0Kind: Int32, _ param0Payload1: Int32, _ param0Payload2: Float64) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(_ callback: Int32, _ param0Kind: Int32, _ param0Payload1: Int32, _ param0Payload2: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y(_ callback: Int32, _ param0Kind: Int32, _ param0Payload1: Int32, _ param0Payload2: Float64) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(callback, param0Kind, param0Payload1, param0Payload2) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestss7JSValueV_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending JSValue) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let (param0Kind, param0Payload1, param0Payload2) = param0.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y(callbackValue, param0Kind, param0Payload1, param0Payload2) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending JSValue) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending JSValue) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y(_ boxPtr: UnsafeMutableRawPointer, _ param0Kind: Int32, _ param0Payload1: Int32, _ param0Payload2: Float64) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending JSValue) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(JSValue.bridgeJSLiftParameter(param0Kind, param0Payload1, param0Payload2)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(callback, param0Bytes, param0Length) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestssSS_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending String) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y(callbackValue, param0Bytes, param0Length) + } + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending String) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending String) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending String) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(_ callback: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(_ callback: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y(_ callback: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestssSaSS_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending [String]) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let _ = param0.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y(callbackValue) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending [String]) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending [String]) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y(_ boxPtr: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending [String]) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure([String].bridgeJSLiftParameter()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(_ callback: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(_ callback: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y(_ callback: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestssSaSb_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending [Bool]) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let _ = param0.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y(callbackValue) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending [Bool]) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending [Bool]) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y(_ boxPtr: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending [Bool]) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure([Bool].bridgeJSLiftParameter()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(_ callback: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(_ callback: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y(_ callback: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestssSaSd_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending [Double]) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let _ = param0.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y(callbackValue) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending [Double]) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending [Double]) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y(_ boxPtr: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending [Double]) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure([Double].bridgeJSLiftParameter()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(_ callback: Int32, _ param0: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(_ callback: Int32, _ param0: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y(_ callback: Int32, _ param0: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestssSb_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending Bool) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y(callbackValue, param0Value) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending Bool) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending Bool) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending Bool) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(Bool.bridgeJSLiftParameter(param0)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(_ callback: Int32, _ param0: Float64) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(_ callback: Int32, _ param0: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y(_ callback: Int32, _ param0: Float64) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(callback, param0) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestssSd_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending Double) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let param0Value = param0.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y(callbackValue, param0Value) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending Double) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending Double) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y(_ boxPtr: UnsafeMutableRawPointer, _ param0: Float64) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending Double) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(Double.bridgeJSLiftParameter(param0)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(callback, param0IsSome, param0Bytes, param0Length) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestssSqSS_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending Optional) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + param0.bridgeJSWithLoweredParameter { (param0IsSome, param0Bytes, param0Length) in + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y(callbackValue, param0IsSome, param0Bytes, param0Length) + } + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending Optional) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending Optional) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending Optional) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(callback, param0IsSome, param0Value) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestssSqSd_y { + static func bridgeJSLift(_ callbackId: Int32) -> (sending Optional) -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] param0 in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let (param0IsSome, param0Value) = param0.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y(callbackValue, param0IsSome, param0Value) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == (sending Optional) -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending Optional) -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending Optional) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(_ callback: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP(_ callback: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsy_13DataProcessorP { + static func bridgeJSLift(_ callbackId: Int32) -> () -> any DataProcessor { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP(callbackValue) + return AnyDataProcessor.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == () -> any DataProcessor { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping () -> any DataProcessor) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP(_ boxPtr: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<() -> any DataProcessor>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure() + return (result as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(_ callback: Int32) -> Int32 +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ callback: Int32) -> Int32 { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsy_Sb { + static func bridgeJSLift(_ callbackId: Int32) -> () -> Bool { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(callbackValue) + return Bool.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == () -> Bool { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping () -> Bool) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ boxPtr: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<() -> Bool>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure() + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(_ callback: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(_ callback: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ callback: Int32) -> UnsafeMutableRawPointer { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC { + static func bridgeJSLift(_ callbackId: Int32) -> () -> Optional { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(callbackValue) + return Optional.bridgeJSLiftReturn(ret) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == () -> Optional { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping () -> Optional) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<() -> Optional>>.fromOpaque(boxPtr).takeUnretainedValue().closure + let result = closure() + return result.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(_ callback: Int32) -> Void +#else +fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(_ callback: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ callback: Int32) -> Void { + return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +#else +fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { + return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(boxPtr, file, line) +} + +private enum _BJS_Closure_20BridgeJSRuntimeTestsy_y { + static func bridgeJSLift(_ callbackId: Int32) -> () -> Void { + let callback = JSObject.bridgeJSLiftParameter(callbackId) + return { [callback] in + #if arch(wasm32) + let callbackValue = callback.bridgeJSLowerParameter() + invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(callbackValue) + #else + fatalError("Only available on WebAssembly") + #endif + } + } +} + +extension JSTypedClosure where Signature == () -> Void { + init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping () -> Void) { + self.init( + makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y, + body: body, + fileID: fileID, + line: line + ) + } +} + +@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") +@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") +public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ boxPtr: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let closure = Unmanaged<_BridgeJSTypedClosureBox<() -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure + closure() + #else + fatalError("Only available on WebAssembly") + #endif +} + +struct AnyArrayElementProtocol: ArrayElementProtocol, _BridgedSwiftProtocolWrapper { + let jsObject: JSObject + + var value: Int { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_ArrayElementProtocol_value_get(jsObjectValue) + return Int.bridgeJSLiftReturn(ret) + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_ArrayElementProtocol_value_set(jsObjectValue, newValueValue) + } + } + + static func bridgeJSLiftParameter(_ value: Int32) -> Self { + return AnyArrayElementProtocol(jsObject: JSObject(id: UInt32(bitPattern: value))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayElementProtocol_value_get") +fileprivate func bjs_ArrayElementProtocol_value_get_extern(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_ArrayElementProtocol_value_get_extern(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArrayElementProtocol_value_get(_ jsObject: Int32) -> Int32 { + return bjs_ArrayElementProtocol_value_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayElementProtocol_value_set") +fileprivate func bjs_ArrayElementProtocol_value_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_ArrayElementProtocol_value_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArrayElementProtocol_value_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + return bjs_ArrayElementProtocol_value_set_extern(jsObject, newValue) +} + +struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { + let jsObject: JSObject + + func increment(by amount: Int) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let amountValue = amount.bridgeJSLowerParameter() + _extern_increment(jsObjectValue, amountValue) + } + + func getValue() -> Int { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_getValue(jsObjectValue) + return Int.bridgeJSLiftReturn(ret) + } + + func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + labelPrefix.bridgeJSWithLoweredParameter { (labelPrefixBytes, labelPrefixLength) in + labelSuffix.bridgeJSWithLoweredParameter { (labelSuffixBytes, labelSuffixLength) in + _extern_setLabelElements(jsObjectValue, labelPrefixBytes, labelPrefixLength, labelSuffixBytes, labelSuffixLength) + } + } + } + + func getLabel() -> String { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_getLabel(jsObjectValue) + return String.bridgeJSLiftReturn(ret) + } + + func isEven() -> Bool { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_isEven(jsObjectValue) + return Bool.bridgeJSLiftReturn(ret) + } + + func processGreeter(_ greeter: Greeter) -> String { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let greeterPointer = greeter.bridgeJSLowerParameter() + let ret = _extern_processGreeter(jsObjectValue, greeterPointer) + return String.bridgeJSLiftReturn(ret) + } + + func createGreeter() -> Greeter { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_createGreeter(jsObjectValue) + return Greeter.bridgeJSLiftReturn(ret) + } + + func processOptionalGreeter(_ greeter: Optional) -> String { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameter() + let ret = _extern_processOptionalGreeter(jsObjectValue, greeterIsSome, greeterPointer) + return String.bridgeJSLiftReturn(ret) + } + + func createOptionalGreeter() -> Optional { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_createOptionalGreeter(jsObjectValue) + return Optional.bridgeJSLiftReturn(ret) + } + + func handleAPIResult(_ result: Optional) -> Void { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (resultIsSome, resultCaseId) = result.bridgeJSLowerParameter() + _extern_handleAPIResult(jsObjectValue, resultIsSome, resultCaseId) + } + + func getAPIResult() -> Optional { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = _extern_getAPIResult(jsObjectValue) + return Optional.bridgeJSLiftReturn(ret) + } + + var count: Int { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_count_get(jsObjectValue) + return Int.bridgeJSLiftReturn(ret) + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_count_set(jsObjectValue, newValueValue) + } + } + + var name: String { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_name_get(jsObjectValue) + return String.bridgeJSLiftReturn(ret) + } + } + + var optionalTag: Optional { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_DataProcessor_optionalTag_get(jsObjectValue) + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + newValue.bridgeJSWithLoweredParameter { (newValueIsSome, newValueBytes, newValueLength) in + bjs_DataProcessor_optionalTag_set(jsObjectValue, newValueIsSome, newValueBytes, newValueLength) + } + } + } + + var optionalCount: Optional { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_DataProcessor_optionalCount_get(jsObjectValue) + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_optionalCount_set(jsObjectValue, newValueIsSome, newValueValue) + } + } + + var direction: Optional { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_direction_get(jsObjectValue) + return Optional.bridgeJSLiftReturn(ret) + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_direction_set(jsObjectValue, newValueIsSome, newValueValue) + } + } + + var optionalTheme: Optional { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_DataProcessor_optionalTheme_get(jsObjectValue) + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + newValue.bridgeJSWithLoweredParameter { (newValueIsSome, newValueBytes, newValueLength) in + bjs_DataProcessor_optionalTheme_set(jsObjectValue, newValueIsSome, newValueBytes, newValueLength) + } + } + } + + var httpStatus: Optional { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + bjs_DataProcessor_httpStatus_get(jsObjectValue) + return Optional.bridgeJSLiftReturnFromSideChannel() + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_httpStatus_set(jsObjectValue, newValueIsSome, newValueValue) + } + } + + var apiResult: Optional { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_apiResult_get(jsObjectValue) + return Optional.bridgeJSLiftReturn(ret) + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValueCaseId) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_apiResult_set(jsObjectValue, newValueIsSome, newValueCaseId) + } + } + + var helper: Greeter { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_helper_get(jsObjectValue) + return Greeter.bridgeJSLiftReturn(ret) + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let newValuePointer = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_helper_set(jsObjectValue, newValuePointer) + } + } + + var optionalHelper: Optional { + get { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let ret = bjs_DataProcessor_optionalHelper_get(jsObjectValue) + return Optional.bridgeJSLiftReturn(ret) + } + set { + let jsObjectValue = jsObject.bridgeJSLowerParameter() + let (newValueIsSome, newValuePointer) = newValue.bridgeJSLowerParameter() + bjs_DataProcessor_optionalHelper_set(jsObjectValue, newValueIsSome, newValuePointer) + } + } + + static func bridgeJSLiftParameter(_ value: Int32) -> Self { + return AnyDataProcessor(jsObject: JSObject(id: UInt32(bitPattern: value))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_increment") +fileprivate func _extern_increment_extern(_ jsObject: Int32, _ amount: Int32) -> Void +#else +fileprivate func _extern_increment_extern(_ jsObject: Int32, _ amount: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_increment(_ jsObject: Int32, _ amount: Int32) -> Void { + return _extern_increment_extern(jsObject, amount) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getValue") +fileprivate func _extern_getValue_extern(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_getValue_extern(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_getValue(_ jsObject: Int32) -> Int32 { + return _extern_getValue_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_setLabelElements") +fileprivate func _extern_setLabelElements_extern(_ jsObject: Int32, _ labelPrefixBytes: Int32, _ labelPrefixLength: Int32, _ labelSuffixBytes: Int32, _ labelSuffixLength: Int32) -> Void +#else +fileprivate func _extern_setLabelElements_extern(_ jsObject: Int32, _ labelPrefixBytes: Int32, _ labelPrefixLength: Int32, _ labelSuffixBytes: Int32, _ labelSuffixLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_setLabelElements(_ jsObject: Int32, _ labelPrefixBytes: Int32, _ labelPrefixLength: Int32, _ labelSuffixBytes: Int32, _ labelSuffixLength: Int32) -> Void { + return _extern_setLabelElements_extern(jsObject, labelPrefixBytes, labelPrefixLength, labelSuffixBytes, labelSuffixLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getLabel") +fileprivate func _extern_getLabel_extern(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_getLabel_extern(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_getLabel(_ jsObject: Int32) -> Int32 { + return _extern_getLabel_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_isEven") +fileprivate func _extern_isEven_extern(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_isEven_extern(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_isEven(_ jsObject: Int32) -> Int32 { + return _extern_isEven_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processGreeter") +fileprivate func _extern_processGreeter_extern(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _extern_processGreeter_extern(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_processGreeter(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 { + return _extern_processGreeter_extern(jsObject, greeter) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createGreeter") +fileprivate func _extern_createGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func _extern_createGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_createGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer { + return _extern_createGreeter_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processOptionalGreeter") +fileprivate func _extern_processOptionalGreeter_extern(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _extern_processOptionalGreeter_extern(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_processOptionalGreeter(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 { + return _extern_processOptionalGreeter_extern(jsObject, greeterIsSome, greeterPointer) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createOptionalGreeter") +fileprivate func _extern_createOptionalGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func _extern_createOptionalGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_createOptionalGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer { + return _extern_createOptionalGreeter_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_handleAPIResult") +fileprivate func _extern_handleAPIResult_extern(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void +#else +fileprivate func _extern_handleAPIResult_extern(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_handleAPIResult(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + return _extern_handleAPIResult_extern(jsObject, resultIsSome, resultCaseId) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getAPIResult") +fileprivate func _extern_getAPIResult_extern(_ jsObject: Int32) -> Int32 +#else +fileprivate func _extern_getAPIResult_extern(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _extern_getAPIResult(_ jsObject: Int32) -> Int32 { + return _extern_getAPIResult_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_get") +fileprivate func bjs_DataProcessor_count_get_extern(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_DataProcessor_count_get_extern(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_count_get(_ jsObject: Int32) -> Int32 { + return bjs_DataProcessor_count_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_set") +fileprivate func bjs_DataProcessor_count_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_count_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_count_set(_ jsObject: Int32, _ newValue: Int32) -> Void { + return bjs_DataProcessor_count_set_extern(jsObject, newValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_name_get") +fileprivate func bjs_DataProcessor_name_get_extern(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_DataProcessor_name_get_extern(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_name_get(_ jsObject: Int32) -> Int32 { + return bjs_DataProcessor_name_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_get") +fileprivate func bjs_DataProcessor_optionalTag_get_extern(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalTag_get_extern(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_optionalTag_get(_ jsObject: Int32) -> Void { + return bjs_DataProcessor_optionalTag_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_set") +fileprivate func bjs_DataProcessor_optionalTag_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalTag_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_optionalTag_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + return bjs_DataProcessor_optionalTag_set_extern(jsObject, newValueIsSome, newValueBytes, newValueLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_get") +fileprivate func bjs_DataProcessor_optionalCount_get_extern(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalCount_get_extern(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_optionalCount_get(_ jsObject: Int32) -> Void { + return bjs_DataProcessor_optionalCount_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_set") +fileprivate func bjs_DataProcessor_optionalCount_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalCount_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_optionalCount_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_DataProcessor_optionalCount_set_extern(jsObject, newValueIsSome, newValueValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_get") +fileprivate func bjs_DataProcessor_direction_get_extern(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_DataProcessor_direction_get_extern(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_direction_get(_ jsObject: Int32) -> Int32 { + return bjs_DataProcessor_direction_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_set") +fileprivate func bjs_DataProcessor_direction_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_direction_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_direction_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_DataProcessor_direction_set_extern(jsObject, newValueIsSome, newValueValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_get") +fileprivate func bjs_DataProcessor_optionalTheme_get_extern(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalTheme_get_extern(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_optionalTheme_get(_ jsObject: Int32) -> Void { + return bjs_DataProcessor_optionalTheme_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_set") +fileprivate func bjs_DataProcessor_optionalTheme_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_optionalTheme_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_optionalTheme_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + return bjs_DataProcessor_optionalTheme_set_extern(jsObject, newValueIsSome, newValueBytes, newValueLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_get") +fileprivate func bjs_DataProcessor_httpStatus_get_extern(_ jsObject: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_httpStatus_get_extern(_ jsObject: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_httpStatus_get(_ jsObject: Int32) -> Void { + return bjs_DataProcessor_httpStatus_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_set") +fileprivate func bjs_DataProcessor_httpStatus_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_httpStatus_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_httpStatus_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { + return bjs_DataProcessor_httpStatus_set_extern(jsObject, newValueIsSome, newValueValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_get") +fileprivate func bjs_DataProcessor_apiResult_get_extern(_ jsObject: Int32) -> Int32 +#else +fileprivate func bjs_DataProcessor_apiResult_get_extern(_ jsObject: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_apiResult_get(_ jsObject: Int32) -> Int32 { + return bjs_DataProcessor_apiResult_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_set") +fileprivate func bjs_DataProcessor_apiResult_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void +#else +fileprivate func bjs_DataProcessor_apiResult_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_apiResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { + return bjs_DataProcessor_apiResult_set_extern(jsObject, newValueIsSome, newValueCaseId) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_get") +fileprivate func bjs_DataProcessor_helper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_DataProcessor_helper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_helper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer { + return bjs_DataProcessor_helper_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_set") +fileprivate func bjs_DataProcessor_helper_set_extern(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void +#else +fileprivate func bjs_DataProcessor_helper_set_extern(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_helper_set(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void { + return bjs_DataProcessor_helper_set_extern(jsObject, newValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_get") +fileprivate func bjs_DataProcessor_optionalHelper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_DataProcessor_optionalHelper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_optionalHelper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer { + return bjs_DataProcessor_optionalHelper_get_extern(jsObject) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_set") +fileprivate func bjs_DataProcessor_optionalHelper_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void +#else +fileprivate func bjs_DataProcessor_optionalHelper_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DataProcessor_optionalHelper_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void { + return bjs_DataProcessor_optionalHelper_set_extern(jsObject, newValueIsSome, newValuePointer) +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripIntArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripIntArray") +public func _bjs_ArraySupportExports_static_roundTripIntArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripIntArray(_: [Int].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripStringArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripStringArray") +public func _bjs_ArraySupportExports_static_roundTripStringArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripStringArray(_: [String].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripDoubleArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripDoubleArray") +public func _bjs_ArraySupportExports_static_roundTripDoubleArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripDoubleArray(_: [Double].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripBoolArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripBoolArray") +public func _bjs_ArraySupportExports_static_roundTripBoolArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripBoolArray(_: [Bool].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUnsafeRawPointerArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripUnsafeRawPointerArray") +public func _bjs_ArraySupportExports_static_roundTripUnsafeRawPointerArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUnsafeMutableRawPointerArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripUnsafeMutableRawPointerArray") +public func _bjs_ArraySupportExports_static_roundTripUnsafeMutableRawPointerArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOpaquePointerArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOpaquePointerArray") +public func _bjs_ArraySupportExports_static_roundTripOpaquePointerArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOpaquePointerArray(_: [OpaquePointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUnsafePointerArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripUnsafePointerArray") +public func _bjs_ArraySupportExports_static_roundTripUnsafePointerArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripUnsafePointerArray(_: [UnsafePointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUnsafeMutablePointerArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripUnsafeMutablePointerArray") +public func _bjs_ArraySupportExports_static_roundTripUnsafeMutablePointerArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripUnsafeMutablePointerArray(_: [UnsafeMutablePointer].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripJSValueArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripJSValueArray") +public func _bjs_ArraySupportExports_static_roundTripJSValueArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripJSValueArray(_: [JSValue].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripJSObjectArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripJSObjectArray") +public func _bjs_ArraySupportExports_static_roundTripJSObjectArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripJSObjectArray(_: [JSObject].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripCaseEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripCaseEnumArray") +public func _bjs_ArraySupportExports_static_roundTripCaseEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripCaseEnumArray(_: [Direction].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripStringRawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripStringRawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripStringRawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripStringRawValueEnumArray(_: [Theme].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripIntRawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripIntRawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripIntRawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripIntRawValueEnumArray(_: [HttpStatus].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripInt64RawValueEnumArray(_: [FileSize].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripUInt64RawValueEnumArray(_: [SessionId].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripStructArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripStructArray") +public func _bjs_ArraySupportExports_static_roundTripStructArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripStructArray(_: [DataPoint].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripSwiftClassArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripSwiftClassArray") +public func _bjs_ArraySupportExports_static_roundTripSwiftClassArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripSwiftClassArray(_: [Greeter].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNamespacedSwiftClassArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripNamespacedSwiftClassArray") +public func _bjs_ArraySupportExports_static_roundTripNamespacedSwiftClassArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripNamespacedSwiftClassArray(_: [Utils.Converter].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripProtocolArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripProtocolArray") +public func _bjs_ArraySupportExports_static_roundTripProtocolArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripProtocolArray(_: [AnyArrayElementProtocol].bridgeJSStackPop()) + for __bjs_elem_ret in ret { + _swift_js_push_i32((__bjs_elem_ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) + } + _swift_js_push_i32(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripJSClassArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripJSClassArray") +public func _bjs_ArraySupportExports_static_roundTripJSClassArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripJSClassArray(_: [ArrayElementObject].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalIntArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalIntArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalIntArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalIntArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalStringArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalStringArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalStringArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalStringArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalJSObjectArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalJSObjectArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalJSObjectArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalJSObjectArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalCaseEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalCaseEnumArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalCaseEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalCaseEnumArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalStringRawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalStringRawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalStringRawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalStringRawValueEnumArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalIntRawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalIntRawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalIntRawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalIntRawValueEnumArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalInt64RawValueEnumArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalUInt64RawValueEnumArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalStructArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalStructArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalStructArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalStructArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalSwiftClassArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalJSClassArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalJSClassArray") +public func _bjs_ArraySupportExports_static_roundTripOptionalJSClassArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripOptionalJSClassArray(_: [Optional].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedIntArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripNestedIntArray") +public func _bjs_ArraySupportExports_static_roundTripNestedIntArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripNestedIntArray(_: [[Int]].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedStringArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripNestedStringArray") +public func _bjs_ArraySupportExports_static_roundTripNestedStringArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripNestedStringArray(_: [[String]].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedDoubleArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripNestedDoubleArray") +public func _bjs_ArraySupportExports_static_roundTripNestedDoubleArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripNestedDoubleArray(_: [[Double]].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedBoolArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripNestedBoolArray") +public func _bjs_ArraySupportExports_static_roundTripNestedBoolArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripNestedBoolArray(_: [[Bool]].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedStructArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripNestedStructArray") +public func _bjs_ArraySupportExports_static_roundTripNestedStructArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripNestedStructArray(_: [[DataPoint]].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedCaseEnumArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripNestedCaseEnumArray") +public func _bjs_ArraySupportExports_static_roundTripNestedCaseEnumArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripNestedCaseEnumArray(_: [[Direction]].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedSwiftClassArray") +@_cdecl("bjs_ArraySupportExports_static_roundTripNestedSwiftClassArray") +public func _bjs_ArraySupportExports_static_roundTripNestedSwiftClassArray() -> Void { + #if arch(wasm32) + let ret = ArraySupportExports.roundTripNestedSwiftClassArray(_: [[Greeter]].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_multiArrayFirst") +@_cdecl("bjs_ArraySupportExports_static_multiArrayFirst") +public func _bjs_ArraySupportExports_static_multiArrayFirst() -> Void { + #if arch(wasm32) + let _tmp_b = [String].bridgeJSStackPop() + let _tmp_a = [Int].bridgeJSStackPop() + let ret = ArraySupportExports.multiArrayFirst(_: _tmp_a, _: _tmp_b) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_multiArraySecond") +@_cdecl("bjs_ArraySupportExports_static_multiArraySecond") +public func _bjs_ArraySupportExports_static_multiArraySecond() -> Void { + #if arch(wasm32) + let _tmp_b = [String].bridgeJSStackPop() + let _tmp_a = [Int].bridgeJSStackPop() + let ret = ArraySupportExports.multiArraySecond(_: _tmp_a, _: _tmp_b) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_multiOptionalArrayFirst") +@_cdecl("bjs_ArraySupportExports_static_multiOptionalArrayFirst") +public func _bjs_ArraySupportExports_static_multiOptionalArrayFirst() -> Void { + #if arch(wasm32) + let _tmp_b = Optional<[String]>.bridgeJSLiftParameter() + let _tmp_a = Optional<[Int]>.bridgeJSLiftParameter() + let ret = ArraySupportExports.multiOptionalArrayFirst(_: _tmp_a, _: _tmp_b) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArraySupportExports_static_multiOptionalArraySecond") +@_cdecl("bjs_ArraySupportExports_static_multiOptionalArraySecond") +public func _bjs_ArraySupportExports_static_multiOptionalArraySecond() -> Void { + #if arch(wasm32) + let _tmp_b = Optional<[String]>.bridgeJSLiftParameter() + let _tmp_a = Optional<[Int]>.bridgeJSLiftParameter() + let ret = ArraySupportExports.multiOptionalArraySecond(_: _tmp_a, _: _tmp_b) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testStringDefault") +@_cdecl("bjs_DefaultArgumentExports_static_testStringDefault") +public func _bjs_DefaultArgumentExports_static_testStringDefault(_ messageBytes: Int32, _ messageLength: Int32) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentExports.testStringDefault(message: String.bridgeJSLiftParameter(messageBytes, messageLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testIntDefault") +@_cdecl("bjs_DefaultArgumentExports_static_testIntDefault") +public func _bjs_DefaultArgumentExports_static_testIntDefault(_ count: Int32) -> Int32 { + #if arch(wasm32) + let ret = DefaultArgumentExports.testIntDefault(count: Int.bridgeJSLiftParameter(count)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testBoolDefault") +@_cdecl("bjs_DefaultArgumentExports_static_testBoolDefault") +public func _bjs_DefaultArgumentExports_static_testBoolDefault(_ flag: Int32) -> Int32 { + #if arch(wasm32) + let ret = DefaultArgumentExports.testBoolDefault(flag: Bool.bridgeJSLiftParameter(flag)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testOptionalDefault") +@_cdecl("bjs_DefaultArgumentExports_static_testOptionalDefault") +public func _bjs_DefaultArgumentExports_static_testOptionalDefault(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentExports.testOptionalDefault(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testMultipleDefaults") +@_cdecl("bjs_DefaultArgumentExports_static_testMultipleDefaults") +public func _bjs_DefaultArgumentExports_static_testMultipleDefaults(_ titleBytes: Int32, _ titleLength: Int32, _ count: Int32, _ enabled: Int32) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentExports.testMultipleDefaults(title: String.bridgeJSLiftParameter(titleBytes, titleLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testSimpleEnumDefault") +@_cdecl("bjs_DefaultArgumentExports_static_testSimpleEnumDefault") +public func _bjs_DefaultArgumentExports_static_testSimpleEnumDefault(_ status: Int32) -> Int32 { + #if arch(wasm32) + let ret = DefaultArgumentExports.testSimpleEnumDefault(status: Status.bridgeJSLiftParameter(status)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testDirectionDefault") +@_cdecl("bjs_DefaultArgumentExports_static_testDirectionDefault") +public func _bjs_DefaultArgumentExports_static_testDirectionDefault(_ direction: Int32) -> Int32 { + #if arch(wasm32) + let ret = DefaultArgumentExports.testDirectionDefault(direction: Direction.bridgeJSLiftParameter(direction)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testRawStringEnumDefault") +@_cdecl("bjs_DefaultArgumentExports_static_testRawStringEnumDefault") +public func _bjs_DefaultArgumentExports_static_testRawStringEnumDefault(_ themeBytes: Int32, _ themeLength: Int32) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentExports.testRawStringEnumDefault(theme: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testComplexInit") +@_cdecl("bjs_DefaultArgumentExports_static_testComplexInit") +public func _bjs_DefaultArgumentExports_static_testComplexInit(_ greeter: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentExports.testComplexInit(greeter: Greeter.bridgeJSLiftParameter(greeter)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_testEmptyInit") +@_cdecl("bjs_DefaultArgumentExports_static_testEmptyInit") +public func _bjs_DefaultArgumentExports_static_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = DefaultArgumentExports.testEmptyInit(_: StaticPropertyHolder.bridgeJSLiftParameter(object)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_createConstructorDefaults") +@_cdecl("bjs_DefaultArgumentExports_static_createConstructorDefaults") +public func _bjs_DefaultArgumentExports_static_createConstructorDefaults(_ nameBytes: Int32, _ nameLength: Int32, _ count: Int32, _ enabled: Int32, _ status: Int32, _ tagIsSome: Int32, _ tagBytes: Int32, _ tagLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = DefaultArgumentExports.createConstructorDefaults(name: String.bridgeJSLiftParameter(nameBytes, nameLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled), status: Status.bridgeJSLiftParameter(status), tag: Optional.bridgeJSLiftParameter(tagIsSome, tagBytes, tagLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_describeConstructorDefaults") +@_cdecl("bjs_DefaultArgumentExports_static_describeConstructorDefaults") +public func _bjs_DefaultArgumentExports_static_describeConstructorDefaults(_ value: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentExports.describeConstructorDefaults(_: DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_arrayWithDefault") +@_cdecl("bjs_DefaultArgumentExports_static_arrayWithDefault") +public func _bjs_DefaultArgumentExports_static_arrayWithDefault() -> Int32 { + #if arch(wasm32) + let ret = DefaultArgumentExports.arrayWithDefault(_: [Int].bridgeJSStackPop()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_arrayWithOptionalDefault") +@_cdecl("bjs_DefaultArgumentExports_static_arrayWithOptionalDefault") +public func _bjs_DefaultArgumentExports_static_arrayWithOptionalDefault() -> Int32 { + #if arch(wasm32) + let ret = DefaultArgumentExports.arrayWithOptionalDefault(_: Optional<[Int]>.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentExports_static_arrayMixedDefaults") +@_cdecl("bjs_DefaultArgumentExports_static_arrayMixedDefaults") +public func _bjs_DefaultArgumentExports_static_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentExports.arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: [Int].bridgeJSStackPop(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Direction: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Direction { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Direction { + return Direction(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { + case 0: + self = .north + case 1: + self = .south + case 2: + self = .east + case 3: + self = .west + default: + return nil + } + } + + private var bridgeJSRawValue: Int32 { + switch self { + case .north: + return 0 + case .south: + return 1 + case .east: + return 2 + case .west: + return 3 + } + } +} + +extension Status: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Status { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Status { + return Status(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { + case 0: + self = .loading + case 1: + self = .success + case 2: + self = .error + default: + return nil + } + } + + private var bridgeJSRawValue: Int32 { + switch self { + case .loading: + return 0 + case .success: + return 1 + case .error: + return 2 + } + } +} + +extension Theme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension HttpStatus: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension FileSize: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension SessionId: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension Precision: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension Ratio: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension TSDirection: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> TSDirection { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> TSDirection { + return TSDirection(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { + case 0: + self = .north + case 1: + self = .south + case 2: + self = .east + case 3: + self = .west + default: + return nil + } + } + + private var bridgeJSRawValue: Int32 { + switch self { + case .north: + return 0 + case .south: + return 1 + case .east: + return 2 + case .west: + return 3 + } + } +} + +extension TSTheme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +@_expose(wasm, "bjs_Utils_StringUtils_static_uppercase") +@_cdecl("bjs_Utils_StringUtils_static_uppercase") +public func _bjs_Utils_StringUtils_static_uppercase(_ textBytes: Int32, _ textLength: Int32) -> Void { + #if arch(wasm32) + let ret = Utils.StringUtils.uppercase(_: String.bridgeJSLiftParameter(textBytes, textLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Utils_StringUtils_static_lowercase") +@_cdecl("bjs_Utils_StringUtils_static_lowercase") +public func _bjs_Utils_StringUtils_static_lowercase(_ textBytes: Int32, _ textLength: Int32) -> Void { + #if arch(wasm32) + let ret = Utils.StringUtils.lowercase(_: String.bridgeJSLiftParameter(textBytes, textLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Networking.API.Method: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Networking.API.Method { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Networking.API.Method { + return Networking.API.Method(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { + case 0: + self = .get + case 1: + self = .post + case 2: + self = .put + case 3: + self = .delete + default: + return nil + } + } + + private var bridgeJSRawValue: Int32 { + switch self { + case .get: + return 0 + case .post: + return 1 + case .put: + return 2 + case .delete: + return 3 + } + } +} + +extension Configuration.LogLevel: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension Configuration.Port: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { +} + +extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Internal.SupportedMethod { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Internal.SupportedMethod { + return Internal.SupportedMethod(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { + case 0: + self = .get + case 1: + self = .post + default: + return nil + } + } + + private var bridgeJSRawValue: Int32 { + switch self { + case .get: + return 0 + case .post: + return 1 + } + } +} + +extension APIResult: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { + switch caseId { + case 0: + return .success(String.bridgeJSStackPop()) + case 1: + return .failure(Int.bridgeJSStackPop()) + case 2: + return .flag(Bool.bridgeJSStackPop()) + case 3: + return .rate(Float.bridgeJSStackPop()) + case 4: + return .precise(Double.bridgeJSStackPop()) + case 5: + return .info + default: + fatalError("Unknown APIResult case ID: \(caseId)") + } + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { + switch self { + case .success(let param0): + param0.bridgeJSStackPush() + return Int32(0) + case .failure(let param0): + param0.bridgeJSStackPush() + return Int32(1) + case .flag(let param0): + param0.bridgeJSStackPush() + return Int32(2) + case .rate(let param0): + param0.bridgeJSStackPush() + return Int32(3) + case .precise(let param0): + param0.bridgeJSStackPush() + return Int32(4) + case .info: + return Int32(5) + } + } +} + +extension ComplexResult: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> ComplexResult { + switch caseId { + case 0: + return .success(String.bridgeJSStackPop()) + case 1: + return .error(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) + case 2: + return .location(Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), String.bridgeJSStackPop()) + case 3: + return .status(Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), String.bridgeJSStackPop()) + case 4: + return .coordinates(Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), Double.bridgeJSStackPop()) + case 5: + return .comprehensive(Bool.bridgeJSStackPop(), Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), Int.bridgeJSStackPop(), Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), String.bridgeJSStackPop(), String.bridgeJSStackPop(), String.bridgeJSStackPop()) + case 6: + return .info + default: + fatalError("Unknown ComplexResult case ID: \(caseId)") + } + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { + switch self { + case .success(let param0): + param0.bridgeJSStackPush() + return Int32(0) + case .error(let param0, let param1): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + return Int32(1) + case .location(let param0, let param1, let param2): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() + return Int32(2) + case .status(let param0, let param1, let param2): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() + return Int32(3) + case .coordinates(let param0, let param1, let param2): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() + return Int32(4) + case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() + param3.bridgeJSStackPush() + param4.bridgeJSStackPush() + param5.bridgeJSStackPush() + param6.bridgeJSStackPush() + param7.bridgeJSStackPush() + param8.bridgeJSStackPush() + return Int32(5) + case .info: + return Int32(6) + } + } +} + +extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> Utilities.Result { + switch caseId { + case 0: + return .success(String.bridgeJSStackPop()) + case 1: + return .failure(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) + case 2: + return .status(Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), String.bridgeJSStackPop()) + default: + fatalError("Unknown Utilities.Result case ID: \(caseId)") + } + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { + switch self { + case .success(let param0): + param0.bridgeJSStackPush() + return Int32(0) + case .failure(let param0, let param1): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + return Int32(1) + case .status(let param0, let param1, let param2): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() + return Int32(2) + } + } +} + +extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> API.NetworkingResult { + switch caseId { + case 0: + return .success(String.bridgeJSStackPop()) + case 1: + return .failure(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) + default: + fatalError("Unknown API.NetworkingResult case ID: \(caseId)") + } + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { + switch self { + case .success(let param0): + param0.bridgeJSStackPush() + return Int32(0) + case .failure(let param0, let param1): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + return Int32(1) + } + } +} + +extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> AllTypesResult { + switch caseId { + case 0: + return .structPayload(Address.bridgeJSStackPop()) + case 1: + return .classPayload(Greeter.bridgeJSStackPop()) + case 2: + return .jsObjectPayload(JSObject.bridgeJSStackPop()) + case 3: + return .nestedEnum(APIResult.bridgeJSStackPop()) + case 4: + return .arrayPayload([Int].bridgeJSStackPop()) + case 5: + return .jsClassPayload(Foo(unsafelyWrapping: JSObject.bridgeJSStackPop())) + case 6: + return .empty + default: + fatalError("Unknown AllTypesResult case ID: \(caseId)") + } + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { + switch self { + case .structPayload(let param0): + param0.bridgeJSStackPush() + return Int32(0) + case .classPayload(let param0): + param0.bridgeJSStackPush() + return Int32(1) + case .jsObjectPayload(let param0): + param0.bridgeJSStackPush() + return Int32(2) + case .nestedEnum(let param0): + param0.bridgeJSStackPush() + return Int32(3) + case .arrayPayload(let param0): + param0.bridgeJSStackPush() + return Int32(4) + case .jsClassPayload(let param0): + param0.jsObject.bridgeJSStackPush() + return Int32(5) + case .empty: + return Int32(6) + } + } +} + +extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> TypedPayloadResult { + switch caseId { + case 0: + return .precision(Precision.bridgeJSStackPop()) + case 1: + return .direction(Direction.bridgeJSStackPop()) + case 2: + return .optPrecision(Optional.bridgeJSStackPop()) + case 3: + return .optDirection(Optional.bridgeJSStackPop()) + case 4: + return .empty + default: + fatalError("Unknown TypedPayloadResult case ID: \(caseId)") + } + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { + switch self { + case .precision(let param0): + param0.bridgeJSStackPush() + return Int32(0) + case .direction(let param0): + param0.bridgeJSStackPush() + return Int32(1) + case .optPrecision(let param0): + param0.bridgeJSStackPush() + return Int32(2) + case .optDirection(let param0): + param0.bridgeJSStackPush() + return Int32(3) + case .empty: + return Int32(4) + } + } +} + +extension StaticCalculator: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> StaticCalculator { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> StaticCalculator { + return StaticCalculator(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { + case 0: + self = .scientific + case 1: + self = .basic + default: + return nil + } + } + + private var bridgeJSRawValue: Int32 { + switch self { + case .scientific: + return 0 + case .basic: + return 1 + } + } +} + +@_expose(wasm, "bjs_StaticCalculator_static_roundtrip") +@_cdecl("bjs_StaticCalculator_static_roundtrip") +public func _bjs_StaticCalculator_static_roundtrip(_ value: Int32) -> Int32 { + #if arch(wasm32) + let ret = StaticCalculator.roundtrip(_: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticCalculator_static_doubleValue") +@_cdecl("bjs_StaticCalculator_static_doubleValue") +public func _bjs_StaticCalculator_static_doubleValue(_ value: Int32) -> Int32 { + #if arch(wasm32) + let ret = StaticCalculator.doubleValue(_: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticCalculator_static_version_get") +@_cdecl("bjs_StaticCalculator_static_version_get") +public func _bjs_StaticCalculator_static_version_get() -> Void { + #if arch(wasm32) + let ret = StaticCalculator.version + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticUtils_Nested_static_roundtrip") +@_cdecl("bjs_StaticUtils_Nested_static_roundtrip") +public func _bjs_StaticUtils_Nested_static_roundtrip(_ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + let ret = StaticUtils.Nested.roundtrip(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Services_Graph_GraphOperations_static_createGraph") +@_cdecl("bjs_Services_Graph_GraphOperations_static_createGraph") +public func _bjs_Services_Graph_GraphOperations_static_createGraph(_ rootId: Int32) -> Int32 { + #if arch(wasm32) + let ret = GraphOperations.createGraph(rootId: Int.bridgeJSLiftParameter(rootId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Services_Graph_GraphOperations_static_nodeCount") +@_cdecl("bjs_Services_Graph_GraphOperations_static_nodeCount") +public func _bjs_Services_Graph_GraphOperations_static_nodeCount(_ graphId: Int32) -> Int32 { + #if arch(wasm32) + let ret = GraphOperations.nodeCount(graphId: Int.bridgeJSLiftParameter(graphId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension StaticPropertyEnum: _BridgedSwiftCaseEnum { + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { + return bridgeJSRawValue + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> StaticPropertyEnum { + return bridgeJSLiftParameter(value) + } + @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> StaticPropertyEnum { + return StaticPropertyEnum(bridgeJSRawValue: value)! + } + @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { + return bridgeJSLowerParameter() + } + + private init?(bridgeJSRawValue: Int32) { + switch bridgeJSRawValue { + case 0: + self = .option1 + case 1: + self = .option2 + default: + return nil + } + } + + private var bridgeJSRawValue: Int32 { + switch self { + case .option1: + return 0 + case .option2: + return 1 + } + } +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_enumProperty_get") +@_cdecl("bjs_StaticPropertyEnum_static_enumProperty_get") +public func _bjs_StaticPropertyEnum_static_enumProperty_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyEnum.enumProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_enumProperty_set") +@_cdecl("bjs_StaticPropertyEnum_static_enumProperty_set") +public func _bjs_StaticPropertyEnum_static_enumProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + StaticPropertyEnum.enumProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_enumConstant_get") +@_cdecl("bjs_StaticPropertyEnum_static_enumConstant_get") +public func _bjs_StaticPropertyEnum_static_enumConstant_get() -> Int32 { + #if arch(wasm32) + let ret = StaticPropertyEnum.enumConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_enumBool_get") +@_cdecl("bjs_StaticPropertyEnum_static_enumBool_get") +public func _bjs_StaticPropertyEnum_static_enumBool_get() -> Int32 { + #if arch(wasm32) + let ret = StaticPropertyEnum.enumBool + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_enumBool_set") +@_cdecl("bjs_StaticPropertyEnum_static_enumBool_set") +public func _bjs_StaticPropertyEnum_static_enumBool_set(_ value: Int32) -> Void { + #if arch(wasm32) + StaticPropertyEnum.enumBool = Bool.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_enumVariable_get") +@_cdecl("bjs_StaticPropertyEnum_static_enumVariable_get") +public func _bjs_StaticPropertyEnum_static_enumVariable_get() -> Int32 { + #if arch(wasm32) + let ret = StaticPropertyEnum.enumVariable + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_enumVariable_set") +@_cdecl("bjs_StaticPropertyEnum_static_enumVariable_set") +public func _bjs_StaticPropertyEnum_static_enumVariable_set(_ value: Int32) -> Void { + #if arch(wasm32) + StaticPropertyEnum.enumVariable = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_computedReadonly_get") +@_cdecl("bjs_StaticPropertyEnum_static_computedReadonly_get") +public func _bjs_StaticPropertyEnum_static_computedReadonly_get() -> Int32 { + #if arch(wasm32) + let ret = StaticPropertyEnum.computedReadonly + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_computedReadWrite_get") +@_cdecl("bjs_StaticPropertyEnum_static_computedReadWrite_get") +public func _bjs_StaticPropertyEnum_static_computedReadWrite_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyEnum.computedReadWrite + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyEnum_static_computedReadWrite_set") +@_cdecl("bjs_StaticPropertyEnum_static_computedReadWrite_set") +public func _bjs_StaticPropertyEnum_static_computedReadWrite_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + StaticPropertyEnum.computedReadWrite = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyNamespace_static_namespaceProperty_get") +@_cdecl("bjs_StaticPropertyNamespace_static_namespaceProperty_get") +public func _bjs_StaticPropertyNamespace_static_namespaceProperty_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyNamespace.namespaceProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyNamespace_static_namespaceProperty_set") +@_cdecl("bjs_StaticPropertyNamespace_static_namespaceProperty_set") +public func _bjs_StaticPropertyNamespace_static_namespaceProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + StaticPropertyNamespace.namespaceProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyNamespace_static_namespaceConstant_get") +@_cdecl("bjs_StaticPropertyNamespace_static_namespaceConstant_get") +public func _bjs_StaticPropertyNamespace_static_namespaceConstant_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyNamespace.namespaceConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_get") +@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_get") +public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_get() -> Int32 { + #if arch(wasm32) + let ret = StaticPropertyNamespace.NestedProperties.nestedProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_set") +@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_set") +public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_set(_ value: Int32) -> Void { + #if arch(wasm32) + StaticPropertyNamespace.NestedProperties.nestedProperty = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedConstant_get") +@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedConstant_get") +public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedConstant_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyNamespace.NestedProperties.nestedConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_get") +@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_get") +public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_get() -> Float64 { + #if arch(wasm32) + let ret = StaticPropertyNamespace.NestedProperties.nestedDouble + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_set") +@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_set") +public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_set(_ value: Float64) -> Void { + #if arch(wasm32) + StaticPropertyNamespace.NestedProperties.nestedDouble = Double.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt(_: Int.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt(_: UInt.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt8") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt8") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt8(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt8(_: Int8.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt8") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt8") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt8(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt8(_: UInt8.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt16") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt16") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt16(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt16(_: Int16.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt16") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt16") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt16(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt16(_: UInt16.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt32") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt32") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt32(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt32(_: Int32.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt32") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt32") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt32(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt32(_: UInt32.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt64") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt64") +public func _bjs_IntegerTypesSupportExports_static_roundTripInt64(_ v: Int64) -> Int64 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripInt64(_: Int64.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt64") +@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt64") +public func _bjs_IntegerTypesSupportExports_static_roundTripUInt64(_ v: Int64) -> Int64 { + #if arch(wasm32) + let ret = IntegerTypesSupportExports.roundTripUInt64(_: UInt64.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalString") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalString") +public func _bjs_OptionalSupportExports_static_roundTripOptionalString(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalString(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalInt") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalInt") +public func _bjs_OptionalSupportExports_static_roundTripOptionalInt(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalInt(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalBool") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalBool") +public func _bjs_OptionalSupportExports_static_roundTripOptionalBool(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalBool(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalFloat") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalFloat") +public func _bjs_OptionalSupportExports_static_roundTripOptionalFloat(_ vIsSome: Int32, _ vValue: Float32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalFloat(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalDouble") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalDouble") +public func _bjs_OptionalSupportExports_static_roundTripOptionalDouble(_ vIsSome: Int32, _ vValue: Float64) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalDouble(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalSyntax") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalSyntax") +public func _bjs_OptionalSupportExports_static_roundTripOptionalSyntax(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalSyntax(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalCaseEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalStringRawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalIntRawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum(_ vIsSome: Int32, _ vValue: Int64) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalInt64RawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum(_ vIsSome: Int32, _ vValue: Int64) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalUInt64RawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTSEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTSEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalTSEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalTSEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalTSStringEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum") +public func _bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalNamespacedEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass") +public func _bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass(_ vIsSome: Int32, _ vValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalSwiftClass(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalIntArray") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalIntArray") +public func _bjs_OptionalSupportExports_static_roundTripOptionalIntArray() -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalIntArray(_: Optional<[Int]>.bridgeJSLiftParameter()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalStringArray") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalStringArray") +public func _bjs_OptionalSupportExports_static_roundTripOptionalStringArray() -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalStringArray(_: Optional<[String]>.bridgeJSLiftParameter()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray") +public func _bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray() -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalSwiftClassArray(_: Optional<[Greeter]>.bridgeJSLiftParameter()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalAPIResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalAPIResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalAPIResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalAPIResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalComplexResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalComplexResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalComplexResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalComplexResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult(_ v: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt") +public func _bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult") +@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult") +public func _bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.roundTripOptionalAPIOptionalResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_takeOptionalJSObject") +@_cdecl("bjs_OptionalSupportExports_static_takeOptionalJSObject") +public func _bjs_OptionalSupportExports_static_takeOptionalJSObject(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + OptionalSupportExports.takeOptionalJSObject(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_applyOptionalGreeter") +@_cdecl("bjs_OptionalSupportExports_static_applyOptionalGreeter") +public func _bjs_OptionalSupportExports_static_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer, _ transform: Int32) -> Void { + #if arch(wasm32) + let ret = OptionalSupportExports.applyOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue), _: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC.bridgeJSLift(transform)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_makeOptionalHolder") +@_cdecl("bjs_OptionalSupportExports_static_makeOptionalHolder") +public func _bjs_OptionalSupportExports_static_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = OptionalSupportExports.makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalSupportExports_static_compareAPIResults") +@_cdecl("bjs_OptionalSupportExports_static_compareAPIResults") +public func _bjs_OptionalSupportExports_static_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { + #if arch(wasm32) + let _tmp_r2 = Optional.bridgeJSLiftParameter(r2IsSome, r2CaseId) + let _tmp_r1 = Optional.bridgeJSLiftParameter(r1IsSome, r1CaseId) + let ret = OptionalSupportExports.compareAPIResults(_: _tmp_r1, _: _tmp_r2) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> OptionalAllTypesResult { + switch caseId { + case 0: + return .optStruct(Optional
.bridgeJSStackPop()) + case 1: + return .optClass(Optional.bridgeJSStackPop()) + case 2: + return .optJSObject(Optional.bridgeJSStackPop()) + case 3: + return .optNestedEnum(Optional.bridgeJSStackPop()) + case 4: + return .optArray(Optional<[Int]>.bridgeJSStackPop()) + case 5: + return .optJsClass(Optional.bridgeJSStackPop().map { Foo(unsafelyWrapping: $0) }) + case 6: + return .empty + default: + fatalError("Unknown OptionalAllTypesResult case ID: \(caseId)") + } + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { + switch self { + case .optStruct(let param0): + param0.bridgeJSStackPush() + return Int32(0) + case .optClass(let param0): + param0.bridgeJSStackPush() + return Int32(1) + case .optJSObject(let param0): + param0.bridgeJSStackPush() + return Int32(2) + case .optNestedEnum(let param0): + param0.bridgeJSStackPush() + return Int32(3) + case .optArray(let param0): + param0.bridgeJSStackPush() + return Int32(4) + case .optJsClass(let param0): + param0.bridgeJSStackPush() + return Int32(5) + case .empty: + return Int32(6) + } + } +} + +extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIOptionalResult { + switch caseId { + case 0: + return .success(Optional.bridgeJSStackPop()) + case 1: + return .failure(Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop()) + case 2: + return .status(Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop()) + default: + fatalError("Unknown APIOptionalResult case ID: \(caseId)") + } + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { + switch self { + case .success(let param0): + param0.bridgeJSStackPush() + return Int32(0) + case .failure(let param0, let param1): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + return Int32(1) + case .status(let param0, let param1, let param2): + param0.bridgeJSStackPush() + param1.bridgeJSStackPush() + param2.bridgeJSStackPush() + return Int32(2) + } + } +} + +extension Point: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Point { + let y = Int.bridgeJSStackPop() + let x = Int.bridgeJSStackPop() + return Point(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") +fileprivate func _bjs_struct_lower_Point_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_Point_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Point_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") +fileprivate func _bjs_struct_lift_Point_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_Point_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_Point() -> Int32 { + return _bjs_struct_lift_Point_extern() +} + +extension PointerFields: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> PointerFields { + let mutPtr = UnsafeMutablePointer.bridgeJSStackPop() + let ptr = UnsafePointer.bridgeJSStackPop() + let opaque = OpaquePointer.bridgeJSStackPop() + let mutRaw = UnsafeMutableRawPointer.bridgeJSStackPop() + let raw = UnsafeRawPointer.bridgeJSStackPop() + return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.raw.bridgeJSStackPush() + self.mutRaw.bridgeJSStackPush() + self.opaque.bridgeJSStackPush() + self.ptr.bridgeJSStackPush() + self.mutPtr.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PointerFields())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") +fileprivate func _bjs_struct_lower_PointerFields_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_PointerFields_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void { + return _bjs_struct_lower_PointerFields_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PointerFields") +fileprivate func _bjs_struct_lift_PointerFields_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_PointerFields_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { + return _bjs_struct_lift_PointerFields_extern() +} + +@_expose(wasm, "bjs_PointerFields_init") +@_cdecl("bjs_PointerFields_init") +public func _bjs_PointerFields_init(_ raw: UnsafeMutableRawPointer, _ mutRaw: UnsafeMutableRawPointer, _ opaque: UnsafeMutableRawPointer, _ ptr: UnsafeMutableRawPointer, _ mutPtr: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PointerFields(raw: UnsafeRawPointer.bridgeJSLiftParameter(raw), mutRaw: UnsafeMutableRawPointer.bridgeJSLiftParameter(mutRaw), opaque: OpaquePointer.bridgeJSLiftParameter(opaque), ptr: UnsafePointer.bridgeJSLiftParameter(ptr), mutPtr: UnsafeMutablePointer.bridgeJSLiftParameter(mutPtr)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension DataPoint: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> DataPoint { + let optFlag = Optional.bridgeJSStackPop() + let optCount = Optional.bridgeJSStackPop() + let label = String.bridgeJSStackPop() + let y = Double.bridgeJSStackPop() + let x = Double.bridgeJSStackPop() + return DataPoint(x: x, y: y, label: label, optCount: optCount, optFlag: optFlag) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() + self.label.bridgeJSStackPush() + self.optCount.bridgeJSStackPush() + self.optFlag.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_DataPoint())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_DataPoint") +fileprivate func _bjs_struct_lower_DataPoint_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_DataPoint_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void { + return _bjs_struct_lower_DataPoint_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_DataPoint") +fileprivate func _bjs_struct_lift_DataPoint_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_DataPoint_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_DataPoint() -> Int32 { + return _bjs_struct_lift_DataPoint_extern() +} + +@_expose(wasm, "bjs_DataPoint_init") +@_cdecl("bjs_DataPoint_init") +public func _bjs_DataPoint_init(_ x: Float64, _ y: Float64, _ labelBytes: Int32, _ labelLength: Int32, _ optCountIsSome: Int32, _ optCountValue: Int32, _ optFlagIsSome: Int32, _ optFlagValue: Int32) -> Void { + #if arch(wasm32) + let ret = DataPoint(x: Double.bridgeJSLiftParameter(x), y: Double.bridgeJSLiftParameter(y), label: String.bridgeJSLiftParameter(labelBytes, labelLength), optCount: Optional.bridgeJSLiftParameter(optCountIsSome, optCountValue), optFlag: Optional.bridgeJSLiftParameter(optFlagIsSome, optFlagValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataPoint_static_dimensions_get") +@_cdecl("bjs_DataPoint_static_dimensions_get") +public func _bjs_DataPoint_static_dimensions_get() -> Int32 { + #if arch(wasm32) + let ret = DataPoint.dimensions + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataPoint_static_origin") +@_cdecl("bjs_DataPoint_static_origin") +public func _bjs_DataPoint_static_origin() -> Void { + #if arch(wasm32) + let ret = DataPoint.origin() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension PublicPoint: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> PublicPoint { + let y = Int.bridgeJSStackPop() + let x = Int.bridgeJSStackPop() + return PublicPoint(x: x, y: y) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.y.bridgeJSStackPush() + } + + public init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_PublicPoint(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + public func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PublicPoint())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PublicPoint") +fileprivate func _bjs_struct_lower_PublicPoint_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_PublicPoint_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_PublicPoint(_ objectId: Int32) -> Void { + return _bjs_struct_lower_PublicPoint_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PublicPoint") +fileprivate func _bjs_struct_lift_PublicPoint_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_PublicPoint_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_PublicPoint() -> Int32 { + return _bjs_struct_lift_PublicPoint_extern() +} + +@_expose(wasm, "bjs_PublicPoint_init") +@_cdecl("bjs_PublicPoint_init") +public func _bjs_PublicPoint_init(_ x: Int32, _ y: Int32) -> Void { + #if arch(wasm32) + let ret = PublicPoint(x: Int.bridgeJSLiftParameter(x), y: Int.bridgeJSLiftParameter(y)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Address: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Address { + let zipCode = Optional.bridgeJSStackPop() + let city = String.bridgeJSStackPop() + let street = String.bridgeJSStackPop() + return Address(street: street, city: city, zipCode: zipCode) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.street.bridgeJSStackPush() + self.city.bridgeJSStackPush() + self.zipCode.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Address())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") +fileprivate func _bjs_struct_lower_Address_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_Address_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Address_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Address") +fileprivate func _bjs_struct_lift_Address_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_Address_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_Address() -> Int32 { + return _bjs_struct_lift_Address_extern() +} + +extension Contact: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Contact { + let secondaryAddress = Optional
.bridgeJSStackPop() + let email = Optional.bridgeJSStackPop() + let address = Address.bridgeJSStackPop() + let age = Int.bridgeJSStackPop() + let name = String.bridgeJSStackPop() + return Contact(name: name, age: age, address: address, email: email, secondaryAddress: secondaryAddress) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() + self.age.bridgeJSStackPush() + self.address.bridgeJSStackPush() + self.email.bridgeJSStackPush() + self.secondaryAddress.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_Contact(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Contact())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Contact") +fileprivate func _bjs_struct_lower_Contact_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_Contact_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Contact_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Contact") +fileprivate func _bjs_struct_lift_Contact_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_Contact_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_Contact() -> Int32 { + return _bjs_struct_lift_Contact_extern() +} + +extension Config: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Config { + let status = Status.bridgeJSStackPop() + let direction = Optional.bridgeJSStackPop() + let theme = Optional.bridgeJSStackPop() + let name = String.bridgeJSStackPop() + return Config(name: name, theme: theme, direction: direction, status: status) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() + self.theme.bridgeJSStackPush() + self.direction.bridgeJSStackPush() + self.status.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Config())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Config") +fileprivate func _bjs_struct_lower_Config_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_Config_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Config_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Config") +fileprivate func _bjs_struct_lift_Config_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_Config_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_Config() -> Int32 { + return _bjs_struct_lift_Config_extern() +} + +extension SessionData: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> SessionData { + let owner = Optional.bridgeJSStackPop() + let id = Int.bridgeJSStackPop() + return SessionData(id: id, owner: owner) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() + self.owner.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_SessionData(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_SessionData())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_SessionData") +fileprivate func _bjs_struct_lower_SessionData_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_SessionData_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Void { + return _bjs_struct_lower_SessionData_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_SessionData") +fileprivate func _bjs_struct_lift_SessionData_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_SessionData_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_SessionData() -> Int32 { + return _bjs_struct_lift_SessionData_extern() +} + +extension ValidationReport: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ValidationReport { + let outcome = Optional.bridgeJSStackPop() + let status = Optional.bridgeJSStackPop() + let result = APIResult.bridgeJSStackPop() + let id = Int.bridgeJSStackPop() + return ValidationReport(id: id, result: result, status: status, outcome: outcome) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() + self.result.bridgeJSStackPush() + self.status.bridgeJSStackPush() + self.outcome.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_ValidationReport(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ValidationReport())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ValidationReport") +fileprivate func _bjs_struct_lower_ValidationReport_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_ValidationReport_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Void { + return _bjs_struct_lower_ValidationReport_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ValidationReport") +fileprivate func _bjs_struct_lift_ValidationReport_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_ValidationReport_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_ValidationReport() -> Int32 { + return _bjs_struct_lift_ValidationReport_extern() +} + +extension AdvancedConfig: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> AdvancedConfig { + let overrideDefaults = Optional.bridgeJSStackPop() + let defaults = ConfigStruct.bridgeJSStackPop() + let location = Optional.bridgeJSStackPop() + let metadata = Optional.bridgeJSStackPop() + let result = Optional.bridgeJSStackPop() + let status = Status.bridgeJSStackPop() + let theme = Theme.bridgeJSStackPop() + let enabled = Bool.bridgeJSStackPop() + let title = String.bridgeJSStackPop() + let id = Int.bridgeJSStackPop() + return AdvancedConfig(id: id, title: title, enabled: enabled, theme: theme, status: status, result: result, metadata: metadata, location: location, defaults: defaults, overrideDefaults: overrideDefaults) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() + self.title.bridgeJSStackPush() + self.enabled.bridgeJSStackPush() + self.theme.bridgeJSStackPush() + self.status.bridgeJSStackPush() + self.result.bridgeJSStackPush() + self.metadata.bridgeJSStackPush() + self.location.bridgeJSStackPush() + self.defaults.bridgeJSStackPush() + self.overrideDefaults.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_AdvancedConfig(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_AdvancedConfig())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_AdvancedConfig") +fileprivate func _bjs_struct_lower_AdvancedConfig_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_AdvancedConfig_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Void { + return _bjs_struct_lower_AdvancedConfig_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_AdvancedConfig") +fileprivate func _bjs_struct_lift_AdvancedConfig_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_AdvancedConfig_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_AdvancedConfig() -> Int32 { + return _bjs_struct_lift_AdvancedConfig_extern() +} + +extension MeasurementConfig: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> MeasurementConfig { + let optionalRatio = Optional.bridgeJSStackPop() + let optionalPrecision = Optional.bridgeJSStackPop() + let ratio = Ratio.bridgeJSStackPop() + let precision = Precision.bridgeJSStackPop() + return MeasurementConfig(precision: precision, ratio: ratio, optionalPrecision: optionalPrecision, optionalRatio: optionalRatio) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.precision.bridgeJSStackPush() + self.ratio.bridgeJSStackPush() + self.optionalPrecision.bridgeJSStackPush() + self.optionalRatio.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_MeasurementConfig(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MeasurementConfig())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MeasurementConfig") +fileprivate func _bjs_struct_lower_MeasurementConfig_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_MeasurementConfig_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Void { + return _bjs_struct_lower_MeasurementConfig_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_MeasurementConfig") +fileprivate func _bjs_struct_lift_MeasurementConfig_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_MeasurementConfig_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_MeasurementConfig() -> Int32 { + return _bjs_struct_lift_MeasurementConfig_extern() +} + +extension MathOperations: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> MathOperations { + let baseValue = Double.bridgeJSStackPop() + return MathOperations(baseValue: baseValue) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.baseValue.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MathOperations())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MathOperations") +fileprivate func _bjs_struct_lower_MathOperations_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_MathOperations_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void { + return _bjs_struct_lower_MathOperations_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_MathOperations") +fileprivate func _bjs_struct_lift_MathOperations_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_MathOperations_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_MathOperations() -> Int32 { + return _bjs_struct_lift_MathOperations_extern() +} + +@_expose(wasm, "bjs_MathOperations_init") +@_cdecl("bjs_MathOperations_init") +public func _bjs_MathOperations_init(_ baseValue: Float64) -> Void { + #if arch(wasm32) + let ret = MathOperations(baseValue: Double.bridgeJSLiftParameter(baseValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MathOperations_add") +@_cdecl("bjs_MathOperations_add") +public func _bjs_MathOperations_add(_ a: Float64, _ b: Float64) -> Float64 { + #if arch(wasm32) + let ret = MathOperations.bridgeJSLiftParameter().add(a: Double.bridgeJSLiftParameter(a), b: Double.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MathOperations_multiply") +@_cdecl("bjs_MathOperations_multiply") +public func _bjs_MathOperations_multiply(_ a: Float64, _ b: Float64) -> Float64 { + #if arch(wasm32) + let ret = MathOperations.bridgeJSLiftParameter().multiply(a: Double.bridgeJSLiftParameter(a), b: Double.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MathOperations_static_subtract") +@_cdecl("bjs_MathOperations_static_subtract") +public func _bjs_MathOperations_static_subtract(_ a: Float64, _ b: Float64) -> Float64 { + #if arch(wasm32) + let ret = MathOperations.subtract(a: Double.bridgeJSLiftParameter(a), b: Double.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension CopyableCart: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> CopyableCart { + let note = Optional.bridgeJSStackPop() + let x = Int.bridgeJSStackPop() + return CopyableCart(x: x, note: note) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.x.bridgeJSStackPush() + self.note.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_CopyableCart(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableCart())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCart") +fileprivate func _bjs_struct_lower_CopyableCart_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_CopyableCart_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Void { + return _bjs_struct_lower_CopyableCart_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_CopyableCart") +fileprivate func _bjs_struct_lift_CopyableCart_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_CopyableCart_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_CopyableCart() -> Int32 { + return _bjs_struct_lift_CopyableCart_extern() +} + +@_expose(wasm, "bjs_CopyableCart_static_fromJSObject") +@_cdecl("bjs_CopyableCart_static_fromJSObject") +public func _bjs_CopyableCart_static_fromJSObject(_ object: Int32) -> Void { + #if arch(wasm32) + let ret = CopyableCart.fromJSObject(_: JSObject.bridgeJSLiftParameter(object)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension CopyableCartItem: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> CopyableCartItem { + let quantity = Int.bridgeJSStackPop() + let sku = String.bridgeJSStackPop() + return CopyableCartItem(sku: sku, quantity: quantity) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.sku.bridgeJSStackPush() + self.quantity.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_CopyableCartItem(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableCartItem())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCartItem") +fileprivate func _bjs_struct_lower_CopyableCartItem_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_CopyableCartItem_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Void { + return _bjs_struct_lower_CopyableCartItem_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_CopyableCartItem") +fileprivate func _bjs_struct_lift_CopyableCartItem_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_CopyableCartItem_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_CopyableCartItem() -> Int32 { + return _bjs_struct_lift_CopyableCartItem_extern() +} + +extension CopyableNestedCart: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> CopyableNestedCart { + let shippingAddress = Optional
.bridgeJSStackPop() + let item = CopyableCartItem.bridgeJSStackPop() + let id = Int.bridgeJSStackPop() + return CopyableNestedCart(id: id, item: item, shippingAddress: shippingAddress) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.id.bridgeJSStackPush() + self.item.bridgeJSStackPush() + self.shippingAddress.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_CopyableNestedCart(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableNestedCart())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableNestedCart") +fileprivate func _bjs_struct_lower_CopyableNestedCart_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_CopyableNestedCart_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Void { + return _bjs_struct_lower_CopyableNestedCart_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_CopyableNestedCart") +fileprivate func _bjs_struct_lift_CopyableNestedCart_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_CopyableNestedCart_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_CopyableNestedCart() -> Int32 { + return _bjs_struct_lift_CopyableNestedCart_extern() +} + +@_expose(wasm, "bjs_CopyableNestedCart_static_fromJSObject") +@_cdecl("bjs_CopyableNestedCart_static_fromJSObject") +public func _bjs_CopyableNestedCart_static_fromJSObject(_ object: Int32) -> Void { + #if arch(wasm32) + let ret = CopyableNestedCart.fromJSObject(_: JSObject.bridgeJSLiftParameter(object)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension ConfigStruct: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ConfigStruct { + let value = Int.bridgeJSStackPop() + let name = String.bridgeJSStackPop() + return ConfigStruct(name: name, value: value) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.name.bridgeJSStackPush() + self.value.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ConfigStruct())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ConfigStruct") +fileprivate func _bjs_struct_lower_ConfigStruct_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_ConfigStruct_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void { + return _bjs_struct_lower_ConfigStruct_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ConfigStruct") +fileprivate func _bjs_struct_lift_ConfigStruct_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_ConfigStruct_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_ConfigStruct() -> Int32 { + return _bjs_struct_lift_ConfigStruct_extern() +} + +@_expose(wasm, "bjs_ConfigStruct_static_defaultConfig_get") +@_cdecl("bjs_ConfigStruct_static_defaultConfig_get") +public func _bjs_ConfigStruct_static_defaultConfig_get() -> Void { + #if arch(wasm32) + let ret = ConfigStruct.defaultConfig + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ConfigStruct_static_defaultConfig_set") +@_cdecl("bjs_ConfigStruct_static_defaultConfig_set") +public func _bjs_ConfigStruct_static_defaultConfig_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + ConfigStruct.defaultConfig = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ConfigStruct_static_maxRetries_get") +@_cdecl("bjs_ConfigStruct_static_maxRetries_get") +public func _bjs_ConfigStruct_static_maxRetries_get() -> Int32 { + #if arch(wasm32) + let ret = ConfigStruct.maxRetries + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ConfigStruct_static_timeout_get") +@_cdecl("bjs_ConfigStruct_static_timeout_get") +public func _bjs_ConfigStruct_static_timeout_get() -> Float64 { + #if arch(wasm32) + let ret = ConfigStruct.timeout + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ConfigStruct_static_timeout_set") +@_cdecl("bjs_ConfigStruct_static_timeout_set") +public func _bjs_ConfigStruct_static_timeout_set(_ value: Float64) -> Void { + #if arch(wasm32) + ConfigStruct.timeout = Double.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ConfigStruct_static_computedSetting_get") +@_cdecl("bjs_ConfigStruct_static_computedSetting_get") +public func _bjs_ConfigStruct_static_computedSetting_get() -> Void { + #if arch(wasm32) + let ret = ConfigStruct.computedSetting + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Vector2D: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Vector2D { + let dy = Double.bridgeJSStackPop() + let dx = Double.bridgeJSStackPop() + return Vector2D(dx: dx, dy: dy) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.dx.bridgeJSStackPush() + self.dy.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_Vector2D(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Vector2D())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Vector2D") +fileprivate func _bjs_struct_lower_Vector2D_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_Vector2D_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_Vector2D(_ objectId: Int32) -> Void { + return _bjs_struct_lower_Vector2D_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Vector2D") +fileprivate func _bjs_struct_lift_Vector2D_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_Vector2D_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_Vector2D() -> Int32 { + return _bjs_struct_lift_Vector2D_extern() +} + +@_expose(wasm, "bjs_Vector2D_init") +@_cdecl("bjs_Vector2D_init") +public func _bjs_Vector2D_init(_ dx: Float64, _ dy: Float64) -> Void { + #if arch(wasm32) + let ret = Vector2D(dx: Double.bridgeJSLiftParameter(dx), dy: Double.bridgeJSLiftParameter(dy)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Vector2D_magnitude") +@_cdecl("bjs_Vector2D_magnitude") +public func _bjs_Vector2D_magnitude() -> Float64 { + #if arch(wasm32) + let ret = Vector2D.bridgeJSLiftParameter().magnitude() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Vector2D_scaled") +@_cdecl("bjs_Vector2D_scaled") +public func _bjs_Vector2D_scaled(_ factor: Float64) -> Void { + #if arch(wasm32) + let ret = Vector2D.bridgeJSLiftParameter().scaled(by: Double.bridgeJSLiftParameter(factor)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension JSObjectContainer: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> JSObjectContainer { + let optionalObject = Optional.bridgeJSStackPop() + let object = JSObject.bridgeJSStackPop() + return JSObjectContainer(object: object, optionalObject: optionalObject) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.object.bridgeJSStackPush() + self.optionalObject.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_JSObjectContainer(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_JSObjectContainer())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_JSObjectContainer") +fileprivate func _bjs_struct_lower_JSObjectContainer_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_JSObjectContainer_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_JSObjectContainer(_ objectId: Int32) -> Void { + return _bjs_struct_lower_JSObjectContainer_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_JSObjectContainer") +fileprivate func _bjs_struct_lift_JSObjectContainer_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_JSObjectContainer_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_JSObjectContainer() -> Int32 { + return _bjs_struct_lift_JSObjectContainer_extern() +} + +extension FooContainer: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> FooContainer { + let optionalFoo = Optional.bridgeJSStackPop().map { Foo(unsafelyWrapping: $0) } + let foo = Foo(unsafelyWrapping: JSObject.bridgeJSStackPop()) + return FooContainer(foo: foo, optionalFoo: optionalFoo) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.foo.jsObject.bridgeJSStackPush() + self.optionalFoo.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_FooContainer(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_FooContainer())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_FooContainer") +fileprivate func _bjs_struct_lower_FooContainer_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_FooContainer_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void { + return _bjs_struct_lower_FooContainer_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_FooContainer") +fileprivate func _bjs_struct_lift_FooContainer_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_FooContainer_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_FooContainer() -> Int32 { + return _bjs_struct_lift_FooContainer_extern() +} + +extension ArrayMembers: _BridgedSwiftStruct { + @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ArrayMembers { + let optStrings = Optional<[String]>.bridgeJSStackPop() + let ints = [Int].bridgeJSStackPop() + return ArrayMembers(ints: ints, optStrings: optStrings) + } + + @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { + self.ints.bridgeJSStackPush() + self.optStrings.bridgeJSStackPush() + } + + init(unsafelyCopying jsObject: JSObject) { + _bjs_struct_lower_ArrayMembers(jsObject.bridgeJSLowerParameter()) + self = Self.bridgeJSStackPop() + } + + func toJSObject() -> JSObject { + let __bjs_self = self + __bjs_self.bridgeJSStackPush() + return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ArrayMembers())) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ArrayMembers") +fileprivate func _bjs_struct_lower_ArrayMembers_extern(_ objectId: Int32) -> Void +#else +fileprivate func _bjs_struct_lower_ArrayMembers_extern(_ objectId: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lower_ArrayMembers(_ objectId: Int32) -> Void { + return _bjs_struct_lower_ArrayMembers_extern(objectId) +} + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ArrayMembers") +fileprivate func _bjs_struct_lift_ArrayMembers_extern() -> Int32 +#else +fileprivate func _bjs_struct_lift_ArrayMembers_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_struct_lift_ArrayMembers() -> Int32 { + return _bjs_struct_lift_ArrayMembers_extern() +} + +@_expose(wasm, "bjs_ArrayMembers_sumValues") +@_cdecl("bjs_ArrayMembers_sumValues") +public func _bjs_ArrayMembers_sumValues() -> Int32 { + #if arch(wasm32) + let ret = ArrayMembers.bridgeJSLiftParameter().sumValues(_: [Int].bridgeJSStackPop()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayMembers_firstString") +@_cdecl("bjs_ArrayMembers_firstString") +public func _bjs_ArrayMembers_firstString() -> Void { + #if arch(wasm32) + let ret = ArrayMembers.bridgeJSLiftParameter().firstString(_: [String].bridgeJSStackPop()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripVoid") +@_cdecl("bjs_roundTripVoid") +public func _bjs_roundTripVoid() -> Void { + #if arch(wasm32) + roundTripVoid() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripFloat") +@_cdecl("bjs_roundTripFloat") +public func _bjs_roundTripFloat(_ v: Float32) -> Float32 { + #if arch(wasm32) + let ret = roundTripFloat(v: Float.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripDouble") +@_cdecl("bjs_roundTripDouble") +public func _bjs_roundTripDouble(_ v: Float64) -> Float64 { + #if arch(wasm32) + let ret = roundTripDouble(v: Double.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripBool") +@_cdecl("bjs_roundTripBool") +public func _bjs_roundTripBool(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundTripBool(v: Bool.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripString") +@_cdecl("bjs_roundTripString") +public func _bjs_roundTripString(_ vBytes: Int32, _ vLength: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripString(v: String.bridgeJSLiftParameter(vBytes, vLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripSwiftHeapObject") +@_cdecl("bjs_roundTripSwiftHeapObject") +public func _bjs_roundTripSwiftHeapObject(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = roundTripSwiftHeapObject(v: Greeter.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUnsafeRawPointer") +@_cdecl("bjs_roundTripUnsafeRawPointer") +public func _bjs_roundTripUnsafeRawPointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = roundTripUnsafeRawPointer(v: UnsafeRawPointer.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUnsafeMutableRawPointer") +@_cdecl("bjs_roundTripUnsafeMutableRawPointer") +public func _bjs_roundTripUnsafeMutableRawPointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = roundTripUnsafeMutableRawPointer(v: UnsafeMutableRawPointer.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOpaquePointer") +@_cdecl("bjs_roundTripOpaquePointer") +public func _bjs_roundTripOpaquePointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = roundTripOpaquePointer(v: OpaquePointer.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUnsafePointer") +@_cdecl("bjs_roundTripUnsafePointer") +public func _bjs_roundTripUnsafePointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = roundTripUnsafePointer(v: UnsafePointer.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUnsafeMutablePointer") +@_cdecl("bjs_roundTripUnsafeMutablePointer") +public func _bjs_roundTripUnsafeMutablePointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = roundTripUnsafeMutablePointer(v: UnsafeMutablePointer.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripJSObject") +@_cdecl("bjs_roundTripJSObject") +public func _bjs_roundTripJSObject(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundTripJSObject(v: JSObject.bridgeJSLiftParameter(v)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripDictionaryExport") +@_cdecl("bjs_roundTripDictionaryExport") +public func _bjs_roundTripDictionaryExport() -> Void { + #if arch(wasm32) + let ret = roundTripDictionaryExport(v: [String: Int].bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalDictionaryExport") +@_cdecl("bjs_roundTripOptionalDictionaryExport") +public func _bjs_roundTripOptionalDictionaryExport() -> Void { + #if arch(wasm32) + let ret = roundTripOptionalDictionaryExport(v: Optional<[String: String]>.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripJSValue") +@_cdecl("bjs_roundTripJSValue") +public func _bjs_roundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { + #if arch(wasm32) + let ret = roundTripJSValue(v: JSValue.bridgeJSLiftParameter(vKind, vPayload1, vPayload2)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalJSValue") +@_cdecl("bjs_roundTripOptionalJSValue") +public func _bjs_roundTripOptionalJSValue(_ vIsSome: Int32, _ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { + #if arch(wasm32) + let ret = roundTripOptionalJSValue(v: Optional.bridgeJSLiftParameter(vIsSome, vKind, vPayload1, vPayload2)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripOptionalJSValueArray") +@_cdecl("bjs_roundTripOptionalJSValueArray") +public func _bjs_roundTripOptionalJSValueArray() -> Void { + #if arch(wasm32) + let ret = roundTripOptionalJSValueArray(v: Optional<[JSValue]>.bridgeJSLiftParameter()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeImportedFoo") +@_cdecl("bjs_makeImportedFoo") +public func _bjs_makeImportedFoo(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { + #if arch(wasm32) + do { + let ret = try makeImportedFoo(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return 0 + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_throwsSwiftError") +@_cdecl("bjs_throwsSwiftError") +public func _bjs_throwsSwiftError(_ shouldThrow: Int32) -> Void { + #if arch(wasm32) + do { + try throwsSwiftError(shouldThrow: Bool.bridgeJSLiftParameter(shouldThrow)) + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_throwsWithIntResult") +@_cdecl("bjs_throwsWithIntResult") +public func _bjs_throwsWithIntResult() -> Int32 { + #if arch(wasm32) + do { + let ret = try throwsWithIntResult() + return ret.bridgeJSLowerReturn() + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return 0 + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_throwsWithStringResult") +@_cdecl("bjs_throwsWithStringResult") +public func _bjs_throwsWithStringResult() -> Void { + #if arch(wasm32) + do { + let ret = try throwsWithStringResult() + return ret.bridgeJSLowerReturn() + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_throwsWithBoolResult") +@_cdecl("bjs_throwsWithBoolResult") +public func _bjs_throwsWithBoolResult() -> Int32 { + #if arch(wasm32) + do { + let ret = try throwsWithBoolResult() + return ret.bridgeJSLowerReturn() + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return 0 + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_throwsWithFloatResult") +@_cdecl("bjs_throwsWithFloatResult") +public func _bjs_throwsWithFloatResult() -> Float32 { + #if arch(wasm32) + do { + let ret = try throwsWithFloatResult() + return ret.bridgeJSLowerReturn() + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return 0.0 + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_throwsWithDoubleResult") +@_cdecl("bjs_throwsWithDoubleResult") +public func _bjs_throwsWithDoubleResult() -> Float64 { + #if arch(wasm32) + do { + let ret = try throwsWithDoubleResult() + return ret.bridgeJSLowerReturn() + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return 0.0 + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_throwsWithSwiftHeapObjectResult") +@_cdecl("bjs_throwsWithSwiftHeapObjectResult") +public func _bjs_throwsWithSwiftHeapObjectResult() -> UnsafeMutableRawPointer { + #if arch(wasm32) + do { + let ret = try throwsWithSwiftHeapObjectResult() + return ret.bridgeJSLowerReturn() + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return UnsafeMutableRawPointer(bitPattern: -1).unsafelyUnwrapped + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_throwsWithJSObjectResult") +@_cdecl("bjs_throwsWithJSObjectResult") +public func _bjs_throwsWithJSObjectResult() -> Int32 { + #if arch(wasm32) + do { + let ret = try throwsWithJSObjectResult() + return ret.bridgeJSLowerReturn() + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return 0 + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_asyncRoundTripVoid") +@_cdecl("bjs_asyncRoundTripVoid") +public func _bjs_asyncRoundTripVoid() -> Int32 { + #if arch(wasm32) + let ret = JSPromise.async { + await asyncRoundTripVoid() + }.jsObject + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_asyncRoundTripInt") +@_cdecl("bjs_asyncRoundTripInt") +public func _bjs_asyncRoundTripInt(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = JSPromise.async { + return await asyncRoundTripInt(v: Int.bridgeJSLiftParameter(v)).jsValue + }.jsObject + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_asyncRoundTripFloat") +@_cdecl("bjs_asyncRoundTripFloat") +public func _bjs_asyncRoundTripFloat(_ v: Float32) -> Int32 { + #if arch(wasm32) + let ret = JSPromise.async { + return await asyncRoundTripFloat(v: Float.bridgeJSLiftParameter(v)).jsValue + }.jsObject + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_asyncRoundTripDouble") +@_cdecl("bjs_asyncRoundTripDouble") +public func _bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { + #if arch(wasm32) + let ret = JSPromise.async { + return await asyncRoundTripDouble(v: Double.bridgeJSLiftParameter(v)).jsValue + }.jsObject + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_asyncRoundTripBool") +@_cdecl("bjs_asyncRoundTripBool") +public func _bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = JSPromise.async { + return await asyncRoundTripBool(v: Bool.bridgeJSLiftParameter(v)).jsValue + }.jsObject + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_asyncRoundTripString") +@_cdecl("bjs_asyncRoundTripString") +public func _bjs_asyncRoundTripString(_ vBytes: Int32, _ vLength: Int32) -> Int32 { + #if arch(wasm32) + let ret = JSPromise.async { + return await asyncRoundTripString(v: String.bridgeJSLiftParameter(vBytes, vLength)).jsValue + }.jsObject + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_asyncRoundTripSwiftHeapObject") +@_cdecl("bjs_asyncRoundTripSwiftHeapObject") +public func _bjs_asyncRoundTripSwiftHeapObject(_ v: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = JSPromise.async { + return await asyncRoundTripSwiftHeapObject(v: Greeter.bridgeJSLiftParameter(v)).jsValue + }.jsObject + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_asyncRoundTripJSObject") +@_cdecl("bjs_asyncRoundTripJSObject") +public func _bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { + #if arch(wasm32) + let ret = JSPromise.async { + return await asyncRoundTripJSObject(v: JSObject.bridgeJSLiftParameter(v)).jsValue + }.jsObject + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_takeGreeter") +@_cdecl("bjs_takeGreeter") +public func _bjs_takeGreeter(_ g: UnsafeMutableRawPointer, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + takeGreeter(g: Greeter.bridgeJSLiftParameter(g), name: String.bridgeJSLiftParameter(nameBytes, nameLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_createCalculator") +@_cdecl("bjs_createCalculator") +public func _bjs_createCalculator() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = createCalculator() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_useCalculator") +@_cdecl("bjs_useCalculator") +public func _bjs_useCalculator(_ calc: UnsafeMutableRawPointer, _ x: Int32, _ y: Int32) -> Int32 { + #if arch(wasm32) + let ret = useCalculator(calc: Calculator.bridgeJSLiftParameter(calc), x: Int.bridgeJSLiftParameter(x), y: Int.bridgeJSLiftParameter(y)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testGreeterToJSValue") +@_cdecl("bjs_testGreeterToJSValue") +public func _bjs_testGreeterToJSValue() -> Int32 { + #if arch(wasm32) + let ret = testGreeterToJSValue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testCalculatorToJSValue") +@_cdecl("bjs_testCalculatorToJSValue") +public func _bjs_testCalculatorToJSValue() -> Int32 { + #if arch(wasm32) + let ret = testCalculatorToJSValue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testSwiftClassAsJSValue") +@_cdecl("bjs_testSwiftClassAsJSValue") +public func _bjs_testSwiftClassAsJSValue(_ greeter: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = testSwiftClassAsJSValue(greeter: Greeter.bridgeJSLiftParameter(greeter)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setDirection") +@_cdecl("bjs_setDirection") +public func _bjs_setDirection(_ direction: Int32) -> Int32 { + #if arch(wasm32) + let ret = setDirection(_: Direction.bridgeJSLiftParameter(direction)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getDirection") +@_cdecl("bjs_getDirection") +public func _bjs_getDirection() -> Int32 { + #if arch(wasm32) + let ret = getDirection() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processDirection") +@_cdecl("bjs_processDirection") +public func _bjs_processDirection(_ input: Int32) -> Int32 { + #if arch(wasm32) + let ret = processDirection(_: Direction.bridgeJSLiftParameter(input)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setTheme") +@_cdecl("bjs_setTheme") +public func _bjs_setTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Void { + #if arch(wasm32) + let ret = setTheme(_: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getTheme") +@_cdecl("bjs_getTheme") +public func _bjs_getTheme() -> Void { + #if arch(wasm32) + let ret = getTheme() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setHttpStatus") +@_cdecl("bjs_setHttpStatus") +public func _bjs_setHttpStatus(_ status: Int32) -> Int32 { + #if arch(wasm32) + let ret = setHttpStatus(_: HttpStatus.bridgeJSLiftParameter(status)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getHttpStatus") +@_cdecl("bjs_getHttpStatus") +public func _bjs_getHttpStatus() -> Int32 { + #if arch(wasm32) + let ret = getHttpStatus() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setFileSize") +@_cdecl("bjs_setFileSize") +public func _bjs_setFileSize(_ size: Int64) -> Int64 { + #if arch(wasm32) + let ret = setFileSize(_: FileSize.bridgeJSLiftParameter(size)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getFileSize") +@_cdecl("bjs_getFileSize") +public func _bjs_getFileSize() -> Int64 { + #if arch(wasm32) + let ret = getFileSize() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setSessionId") +@_cdecl("bjs_setSessionId") +public func _bjs_setSessionId(_ session: Int64) -> Int64 { + #if arch(wasm32) + let ret = setSessionId(_: SessionId.bridgeJSLiftParameter(session)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getSessionId") +@_cdecl("bjs_getSessionId") +public func _bjs_getSessionId() -> Int64 { + #if arch(wasm32) + let ret = getSessionId() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processTheme") +@_cdecl("bjs_processTheme") +public func _bjs_processTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Int32 { + #if arch(wasm32) + let ret = processTheme(_: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setTSDirection") +@_cdecl("bjs_setTSDirection") +public func _bjs_setTSDirection(_ direction: Int32) -> Int32 { + #if arch(wasm32) + let ret = setTSDirection(_: TSDirection.bridgeJSLiftParameter(direction)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getTSDirection") +@_cdecl("bjs_getTSDirection") +public func _bjs_getTSDirection() -> Int32 { + #if arch(wasm32) + let ret = getTSDirection() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setTSTheme") +@_cdecl("bjs_setTSTheme") +public func _bjs_setTSTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Void { + #if arch(wasm32) + let ret = setTSTheme(_: TSTheme.bridgeJSLiftParameter(themeBytes, themeLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getTSTheme") +@_cdecl("bjs_getTSTheme") +public func _bjs_getTSTheme() -> Void { + #if arch(wasm32) + let ret = getTSTheme() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_createConverter") +@_cdecl("bjs_createConverter") +public func _bjs_createConverter() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = createConverter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_useConverter") +@_cdecl("bjs_useConverter") +public func _bjs_useConverter(_ converter: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + let ret = useConverter(converter: Utils.Converter.bridgeJSLiftParameter(converter), value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripConverterArray") +@_cdecl("bjs_roundTripConverterArray") +public func _bjs_roundTripConverterArray() -> Void { + #if arch(wasm32) + let ret = roundTripConverterArray(_: [Utils.Converter].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_createHTTPServer") +@_cdecl("bjs_createHTTPServer") +public func _bjs_createHTTPServer() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = createHTTPServer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_createUUID") +@_cdecl("bjs_createUUID") +public func _bjs_createUUID(_ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = createUUID(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripUUID") +@_cdecl("bjs_roundTripUUID") +public func _bjs_roundTripUUID(_ uuid: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = roundTripUUID(_: UUID.bridgeJSLiftParameter(uuid)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtripNetworkingAPIMethod") +@_cdecl("bjs_roundtripNetworkingAPIMethod") +public func _bjs_roundtripNetworkingAPIMethod(_ method: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundtripNetworkingAPIMethod(_: Networking.API.Method.bridgeJSLiftParameter(method)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtripConfigurationLogLevel") +@_cdecl("bjs_roundtripConfigurationLogLevel") +public func _bjs_roundtripConfigurationLogLevel(_ levelBytes: Int32, _ levelLength: Int32) -> Void { + #if arch(wasm32) + let ret = roundtripConfigurationLogLevel(_: Configuration.LogLevel.bridgeJSLiftParameter(levelBytes, levelLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtripConfigurationPort") +@_cdecl("bjs_roundtripConfigurationPort") +public func _bjs_roundtripConfigurationPort(_ port: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundtripConfigurationPort(_: Configuration.Port.bridgeJSLiftParameter(port)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_processConfigurationLogLevel") +@_cdecl("bjs_processConfigurationLogLevel") +public func _bjs_processConfigurationLogLevel(_ levelBytes: Int32, _ levelLength: Int32) -> Int32 { + #if arch(wasm32) + let ret = processConfigurationLogLevel(_: Configuration.LogLevel.bridgeJSLiftParameter(levelBytes, levelLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtripInternalSupportedMethod") +@_cdecl("bjs_roundtripInternalSupportedMethod") +public func _bjs_roundtripInternalSupportedMethod(_ method: Int32) -> Int32 { + #if arch(wasm32) + let ret = roundtripInternalSupportedMethod(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtripAPIResult") +@_cdecl("bjs_roundtripAPIResult") +public func _bjs_roundtripAPIResult(_ result: Int32) -> Void { + #if arch(wasm32) + let ret = roundtripAPIResult(result: APIResult.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAPIResultSuccess") +@_cdecl("bjs_makeAPIResultSuccess") +public func _bjs_makeAPIResultSuccess(_ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + let ret = makeAPIResultSuccess(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAPIResultFailure") +@_cdecl("bjs_makeAPIResultFailure") +public func _bjs_makeAPIResultFailure(_ value: Int32) -> Void { + #if arch(wasm32) + let ret = makeAPIResultFailure(_: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAPIResultInfo") +@_cdecl("bjs_makeAPIResultInfo") +public func _bjs_makeAPIResultInfo() -> Void { + #if arch(wasm32) + let ret = makeAPIResultInfo() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAPIResultFlag") +@_cdecl("bjs_makeAPIResultFlag") +public func _bjs_makeAPIResultFlag(_ value: Int32) -> Void { + #if arch(wasm32) + let ret = makeAPIResultFlag(_: Bool.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAPIResultRate") +@_cdecl("bjs_makeAPIResultRate") +public func _bjs_makeAPIResultRate(_ value: Float32) -> Void { + #if arch(wasm32) + let ret = makeAPIResultRate(_: Float.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAPIResultPrecise") +@_cdecl("bjs_makeAPIResultPrecise") +public func _bjs_makeAPIResultPrecise(_ value: Float64) -> Void { + #if arch(wasm32) + let ret = makeAPIResultPrecise(_: Double.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtripComplexResult") +@_cdecl("bjs_roundtripComplexResult") +public func _bjs_roundtripComplexResult(_ result: Int32) -> Void { + #if arch(wasm32) + let ret = roundtripComplexResult(_: ComplexResult.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeComplexResultSuccess") +@_cdecl("bjs_makeComplexResultSuccess") +public func _bjs_makeComplexResultSuccess(_ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + let ret = makeComplexResultSuccess(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeComplexResultError") +@_cdecl("bjs_makeComplexResultError") +public func _bjs_makeComplexResultError(_ messageBytes: Int32, _ messageLength: Int32, _ code: Int32) -> Void { + #if arch(wasm32) + let ret = makeComplexResultError(_: String.bridgeJSLiftParameter(messageBytes, messageLength), _: Int.bridgeJSLiftParameter(code)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeComplexResultLocation") +@_cdecl("bjs_makeComplexResultLocation") +public func _bjs_makeComplexResultLocation(_ lat: Float64, _ lng: Float64, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + let ret = makeComplexResultLocation(_: Double.bridgeJSLiftParameter(lat), _: Double.bridgeJSLiftParameter(lng), _: String.bridgeJSLiftParameter(nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeComplexResultStatus") +@_cdecl("bjs_makeComplexResultStatus") +public func _bjs_makeComplexResultStatus(_ active: Int32, _ code: Int32, _ messageBytes: Int32, _ messageLength: Int32) -> Void { + #if arch(wasm32) + let ret = makeComplexResultStatus(_: Bool.bridgeJSLiftParameter(active), _: Int.bridgeJSLiftParameter(code), _: String.bridgeJSLiftParameter(messageBytes, messageLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeComplexResultCoordinates") +@_cdecl("bjs_makeComplexResultCoordinates") +public func _bjs_makeComplexResultCoordinates(_ x: Float64, _ y: Float64, _ z: Float64) -> Void { + #if arch(wasm32) + let ret = makeComplexResultCoordinates(_: Double.bridgeJSLiftParameter(x), _: Double.bridgeJSLiftParameter(y), _: Double.bridgeJSLiftParameter(z)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeComplexResultComprehensive") +@_cdecl("bjs_makeComplexResultComprehensive") +public func _bjs_makeComplexResultComprehensive(_ flag1: Int32, _ flag2: Int32, _ count1: Int32, _ count2: Int32, _ value1: Float64, _ value2: Float64, _ text1Bytes: Int32, _ text1Length: Int32, _ text2Bytes: Int32, _ text2Length: Int32, _ text3Bytes: Int32, _ text3Length: Int32) -> Void { + #if arch(wasm32) + let ret = makeComplexResultComprehensive(_: Bool.bridgeJSLiftParameter(flag1), _: Bool.bridgeJSLiftParameter(flag2), _: Int.bridgeJSLiftParameter(count1), _: Int.bridgeJSLiftParameter(count2), _: Double.bridgeJSLiftParameter(value1), _: Double.bridgeJSLiftParameter(value2), _: String.bridgeJSLiftParameter(text1Bytes, text1Length), _: String.bridgeJSLiftParameter(text2Bytes, text2Length), _: String.bridgeJSLiftParameter(text3Bytes, text3Length)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeComplexResultInfo") +@_cdecl("bjs_makeComplexResultInfo") +public func _bjs_makeComplexResultInfo() -> Void { + #if arch(wasm32) + let ret = makeComplexResultInfo() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeUtilitiesResultSuccess") +@_cdecl("bjs_makeUtilitiesResultSuccess") +public func _bjs_makeUtilitiesResultSuccess(_ messageBytes: Int32, _ messageLength: Int32) -> Void { + #if arch(wasm32) + let ret = makeUtilitiesResultSuccess(_: String.bridgeJSLiftParameter(messageBytes, messageLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeUtilitiesResultFailure") +@_cdecl("bjs_makeUtilitiesResultFailure") +public func _bjs_makeUtilitiesResultFailure(_ errorBytes: Int32, _ errorLength: Int32, _ code: Int32) -> Void { + #if arch(wasm32) + let ret = makeUtilitiesResultFailure(_: String.bridgeJSLiftParameter(errorBytes, errorLength), _: Int.bridgeJSLiftParameter(code)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeUtilitiesResultStatus") +@_cdecl("bjs_makeUtilitiesResultStatus") +public func _bjs_makeUtilitiesResultStatus(_ active: Int32, _ code: Int32, _ messageBytes: Int32, _ messageLength: Int32) -> Void { + #if arch(wasm32) + let ret = makeUtilitiesResultStatus(_: Bool.bridgeJSLiftParameter(active), _: Int.bridgeJSLiftParameter(code), _: String.bridgeJSLiftParameter(messageBytes, messageLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAPINetworkingResultSuccess") +@_cdecl("bjs_makeAPINetworkingResultSuccess") +public func _bjs_makeAPINetworkingResultSuccess(_ messageBytes: Int32, _ messageLength: Int32) -> Void { + #if arch(wasm32) + let ret = makeAPINetworkingResultSuccess(_: String.bridgeJSLiftParameter(messageBytes, messageLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAPINetworkingResultFailure") +@_cdecl("bjs_makeAPINetworkingResultFailure") +public func _bjs_makeAPINetworkingResultFailure(_ errorBytes: Int32, _ errorLength: Int32, _ code: Int32) -> Void { + #if arch(wasm32) + let ret = makeAPINetworkingResultFailure(_: String.bridgeJSLiftParameter(errorBytes, errorLength), _: Int.bridgeJSLiftParameter(code)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtripUtilitiesResult") +@_cdecl("bjs_roundtripUtilitiesResult") +public func _bjs_roundtripUtilitiesResult(_ result: Int32) -> Void { + #if arch(wasm32) + let ret = roundtripUtilitiesResult(_: Utilities.Result.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundtripAPINetworkingResult") +@_cdecl("bjs_roundtripAPINetworkingResult") +public func _bjs_roundtripAPINetworkingResult(_ result: Int32) -> Void { + #if arch(wasm32) + let ret = roundtripAPINetworkingResult(_: API.NetworkingResult.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripAllTypesResult") +@_cdecl("bjs_roundTripAllTypesResult") +public func _bjs_roundTripAllTypesResult(_ result: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripAllTypesResult(_: AllTypesResult.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripTypedPayloadResult") +@_cdecl("bjs_roundTripTypedPayloadResult") +public func _bjs_roundTripTypedPayloadResult(_ result: Int32) -> Void { + #if arch(wasm32) + let ret = roundTripTypedPayloadResult(_: TypedPayloadResult.bridgeJSLiftParameter(result)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_createPropertyHolder") +@_cdecl("bjs_createPropertyHolder") +public func _bjs_createPropertyHolder(_ intValue: Int32, _ floatValue: Float32, _ doubleValue: Float64, _ boolValue: Int32, _ stringValueBytes: Int32, _ stringValueLength: Int32, _ jsObject: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = createPropertyHolder(intValue: Int.bridgeJSLiftParameter(intValue), floatValue: Float.bridgeJSLiftParameter(floatValue), doubleValue: Double.bridgeJSLiftParameter(doubleValue), boolValue: Bool.bridgeJSLiftParameter(boolValue), stringValue: String.bridgeJSLiftParameter(stringValueBytes, stringValueLength), jsObject: JSObject.bridgeJSLiftParameter(jsObject)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testPropertyHolder") +@_cdecl("bjs_testPropertyHolder") +public func _bjs_testPropertyHolder(_ holder: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = testPropertyHolder(holder: PropertyHolder.bridgeJSLiftParameter(holder)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_resetObserverCounts") +@_cdecl("bjs_resetObserverCounts") +public func _bjs_resetObserverCounts() -> Void { + #if arch(wasm32) + resetObserverCounts() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getObserverStats") +@_cdecl("bjs_getObserverStats") +public func _bjs_getObserverStats() -> Void { + #if arch(wasm32) + let ret = getObserverStats() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_formatName") +@_cdecl("bjs_formatName") +public func _bjs_formatName(_ nameBytes: Int32, _ nameLength: Int32, _ transform: Int32) -> Void { + #if arch(wasm32) + let ret = formatName(_: String.bridgeJSLiftParameter(nameBytes, nameLength), transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeFormatter") +@_cdecl("bjs_makeFormatter") +public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { + #if arch(wasm32) + let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_makeAdder") +@_cdecl("bjs_makeAdder") +public func _bjs_makeAdder(_ base: Int32) -> Int32 { + #if arch(wasm32) + let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getSharedSubject") +@_cdecl("bjs_getSharedSubject") +public func _bjs_getSharedSubject() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = getSharedSubject() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_resetSharedSubject") +@_cdecl("bjs_resetSharedSubject") +public func _bjs_resetSharedSubject() -> Void { + #if arch(wasm32) + resetSharedSubject() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getRetainLeakSubject") +@_cdecl("bjs_getRetainLeakSubject") +public func _bjs_getRetainLeakSubject() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = getRetainLeakSubject() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_resetRetainLeakSubject") +@_cdecl("bjs_resetRetainLeakSubject") +public func _bjs_resetRetainLeakSubject() -> Void { + #if arch(wasm32) + resetRetainLeakSubject() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getRetainLeakDeinits") +@_cdecl("bjs_getRetainLeakDeinits") +public func _bjs_getRetainLeakDeinits() -> Int32 { + #if arch(wasm32) + let ret = getRetainLeakDeinits() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_resetRetainLeakDeinits") +@_cdecl("bjs_resetRetainLeakDeinits") +public func _bjs_resetRetainLeakDeinits() -> Void { + #if arch(wasm32) + resetRetainLeakDeinits() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_setupArrayPool") +@_cdecl("bjs_setupArrayPool") +public func _bjs_setupArrayPool(_ count: Int32) -> Void { + #if arch(wasm32) + setupArrayPool(_: Int.bridgeJSLiftParameter(count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getArrayPool") +@_cdecl("bjs_getArrayPool") +public func _bjs_getArrayPool() -> Void { + #if arch(wasm32) + let ret = getArrayPool() + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getArrayPoolElement") +@_cdecl("bjs_getArrayPoolElement") +public func _bjs_getArrayPoolElement(_ index: Int32) -> Void { + #if arch(wasm32) + let ret = getArrayPoolElement(_: Int.bridgeJSLiftParameter(index)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_getArrayPoolDeinits") +@_cdecl("bjs_getArrayPoolDeinits") +public func _bjs_getArrayPoolDeinits() -> Int32 { + #if arch(wasm32) + let ret = getArrayPoolDeinits() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_resetArrayPoolDeinits") +@_cdecl("bjs_resetArrayPoolDeinits") +public func _bjs_resetArrayPoolDeinits() -> Void { + #if arch(wasm32) + resetArrayPoolDeinits() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_clearArrayPool") +@_cdecl("bjs_clearArrayPool") +public func _bjs_clearArrayPool() -> Void { + #if arch(wasm32) + clearArrayPool() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripPointerFields") +@_cdecl("bjs_roundTripPointerFields") +public func _bjs_roundTripPointerFields() -> Void { + #if arch(wasm32) + let ret = roundTripPointerFields(_: PointerFields.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testStructDefault") +@_cdecl("bjs_testStructDefault") +public func _bjs_testStructDefault() -> Void { + #if arch(wasm32) + let ret = testStructDefault(point: DataPoint.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_cartToJSObject") +@_cdecl("bjs_cartToJSObject") +public func _bjs_cartToJSObject() -> Int32 { + #if arch(wasm32) + let ret = cartToJSObject(_: CopyableCart.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_nestedCartToJSObject") +@_cdecl("bjs_nestedCartToJSObject") +public func _bjs_nestedCartToJSObject() -> Int32 { + #if arch(wasm32) + let ret = nestedCartToJSObject(_: CopyableNestedCart.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripDataPoint") +@_cdecl("bjs_roundTripDataPoint") +public func _bjs_roundTripDataPoint() -> Void { + #if arch(wasm32) + let ret = roundTripDataPoint(_: DataPoint.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripPublicPoint") +@_cdecl("bjs_roundTripPublicPoint") +public func _bjs_roundTripPublicPoint() -> Void { + #if arch(wasm32) + let ret = roundTripPublicPoint(_: PublicPoint.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripContact") +@_cdecl("bjs_roundTripContact") +public func _bjs_roundTripContact() -> Void { + #if arch(wasm32) + let ret = roundTripContact(_: Contact.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripConfig") +@_cdecl("bjs_roundTripConfig") +public func _bjs_roundTripConfig() -> Void { + #if arch(wasm32) + let ret = roundTripConfig(_: Config.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripSessionData") +@_cdecl("bjs_roundTripSessionData") +public func _bjs_roundTripSessionData() -> Void { + #if arch(wasm32) + let ret = roundTripSessionData(_: SessionData.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripValidationReport") +@_cdecl("bjs_roundTripValidationReport") +public func _bjs_roundTripValidationReport() -> Void { + #if arch(wasm32) + let ret = roundTripValidationReport(_: ValidationReport.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripAdvancedConfig") +@_cdecl("bjs_roundTripAdvancedConfig") +public func _bjs_roundTripAdvancedConfig() -> Void { + #if arch(wasm32) + let ret = roundTripAdvancedConfig(_: AdvancedConfig.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripMeasurementConfig") +@_cdecl("bjs_roundTripMeasurementConfig") +public func _bjs_roundTripMeasurementConfig() -> Void { + #if arch(wasm32) + let ret = roundTripMeasurementConfig(_: MeasurementConfig.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_updateValidationReport") +@_cdecl("bjs_updateValidationReport") +public func _bjs_updateValidationReport(_ newResultIsSome: Int32, _ newResultCaseId: Int32) -> Void { + #if arch(wasm32) + let _tmp_report = ValidationReport.bridgeJSLiftParameter() + let _tmp_newResult = Optional.bridgeJSLiftParameter(newResultIsSome, newResultCaseId) + let ret = updateValidationReport(_: _tmp_newResult, _: _tmp_report) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_testContainerWithStruct") +@_cdecl("bjs_testContainerWithStruct") +public func _bjs_testContainerWithStruct() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = testContainerWithStruct(_: DataPoint.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripJSObjectContainer") +@_cdecl("bjs_roundTripJSObjectContainer") +public func _bjs_roundTripJSObjectContainer() -> Void { + #if arch(wasm32) + let ret = roundTripJSObjectContainer(_: JSObjectContainer.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripFooContainer") +@_cdecl("bjs_roundTripFooContainer") +public func _bjs_roundTripFooContainer() -> Void { + #if arch(wasm32) + let ret = roundTripFooContainer(_: FooContainer.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_roundTripArrayMembers") +@_cdecl("bjs_roundTripArrayMembers") +public func _bjs_roundTripArrayMembers() -> Void { + #if arch(wasm32) + let ret = roundTripArrayMembers(_: ArrayMembers.bridgeJSLiftParameter()) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_arrayMembersSum") +@_cdecl("bjs_arrayMembersSum") +public func _bjs_arrayMembersSum() -> Int32 { + #if arch(wasm32) + let _tmp_values = [Int].bridgeJSStackPop() + let _tmp_value = ArrayMembers.bridgeJSLiftParameter() + let ret = arrayMembersSum(_: _tmp_value, _: _tmp_values) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_arrayMembersFirst") +@_cdecl("bjs_arrayMembersFirst") +public func _bjs_arrayMembersFirst() -> Void { + #if arch(wasm32) + let _tmp_values = [String].bridgeJSStackPop() + let _tmp_value = ArrayMembers.bridgeJSLiftParameter() + let ret = arrayMembersFirst(_: _tmp_value, _: _tmp_values) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClosureSupportExports_static_makeIntToInt") +@_cdecl("bjs_ClosureSupportExports_static_makeIntToInt") +public func _bjs_ClosureSupportExports_static_makeIntToInt(_ base: Int32) -> Int32 { + #if arch(wasm32) + let ret = ClosureSupportExports.makeIntToInt(_: Int.bridgeJSLiftParameter(base)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClosureSupportExports_static_makeDoubleToDouble") +@_cdecl("bjs_ClosureSupportExports_static_makeDoubleToDouble") +public func _bjs_ClosureSupportExports_static_makeDoubleToDouble(_ base: Float64) -> Int32 { + #if arch(wasm32) + let ret = ClosureSupportExports.makeDoubleToDouble(_: Double.bridgeJSLiftParameter(base)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClosureSupportExports_static_makeStringToString") +@_cdecl("bjs_ClosureSupportExports_static_makeStringToString") +public func _bjs_ClosureSupportExports_static_makeStringToString(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { + #if arch(wasm32) + let ret = ClosureSupportExports.makeStringToString(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClosureSupportExports_static_makeJSIntToInt") +@_cdecl("bjs_ClosureSupportExports_static_makeJSIntToInt") +public func _bjs_ClosureSupportExports_static_makeJSIntToInt(_ base: Int32) -> Int32 { + #if arch(wasm32) + let ret = ClosureSupportExports.makeJSIntToInt(_: Int.bridgeJSLiftParameter(base)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClosureSupportExports_static_makeJSDoubleToDouble") +@_cdecl("bjs_ClosureSupportExports_static_makeJSDoubleToDouble") +public func _bjs_ClosureSupportExports_static_makeJSDoubleToDouble(_ base: Float64) -> Int32 { + #if arch(wasm32) + let ret = ClosureSupportExports.makeJSDoubleToDouble(_: Double.bridgeJSLiftParameter(base)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClosureSupportExports_static_makeJSStringToString") +@_cdecl("bjs_ClosureSupportExports_static_makeJSStringToString") +public func _bjs_ClosureSupportExports_static_makeJSStringToString(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { + #if arch(wasm32) + let ret = ClosureSupportExports.makeJSStringToString(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClosureSupportExports_deinit") +@_cdecl("bjs_ClosureSupportExports_deinit") +public func _bjs_ClosureSupportExports_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension ClosureSupportExports: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ClosureSupportExports_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_ClosureSupportExports_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportExports_wrap") +fileprivate func _bjs_ClosureSupportExports_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ClosureSupportExports_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_ClosureSupportExports_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ClosureSupportExports_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_init") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_init") +public func _bjs_DefaultArgumentConstructorDefaults_init(_ nameBytes: Int32, _ nameLength: Int32, _ count: Int32, _ enabled: Int32, _ status: Int32, _ tagIsSome: Int32, _ tagBytes: Int32, _ tagLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = DefaultArgumentConstructorDefaults(name: String.bridgeJSLiftParameter(nameBytes, nameLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled), status: Status.bridgeJSLiftParameter(status), tag: Optional.bridgeJSLiftParameter(tagIsSome, tagBytes, tagLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_describe") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_describe") +public func _bjs_DefaultArgumentConstructorDefaults_describe(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).describe() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_name_get") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_name_get") +public func _bjs_DefaultArgumentConstructorDefaults_name_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).name + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_name_set") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_name_set") +public func _bjs_DefaultArgumentConstructorDefaults_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_count_get") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_count_get") +public func _bjs_DefaultArgumentConstructorDefaults_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).count + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_count_set") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_count_set") +public func _bjs_DefaultArgumentConstructorDefaults_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_enabled_get") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_enabled_get") +public func _bjs_DefaultArgumentConstructorDefaults_enabled_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).enabled + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_enabled_set") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_enabled_set") +public func _bjs_DefaultArgumentConstructorDefaults_enabled_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).enabled = Bool.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_status_get") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_status_get") +public func _bjs_DefaultArgumentConstructorDefaults_status_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).status + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_status_set") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_status_set") +public func _bjs_DefaultArgumentConstructorDefaults_status_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).status = Status.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_tag_get") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_tag_get") +public func _bjs_DefaultArgumentConstructorDefaults_tag_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).tag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_tag_set") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_tag_set") +public func _bjs_DefaultArgumentConstructorDefaults_tag_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).tag = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_deinit") +@_cdecl("bjs_DefaultArgumentConstructorDefaults_deinit") +public func _bjs_DefaultArgumentConstructorDefaults_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension DefaultArgumentConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_DefaultArgumentConstructorDefaults_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_DefaultArgumentConstructorDefaults_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DefaultArgumentConstructorDefaults_wrap") +fileprivate func _bjs_DefaultArgumentConstructorDefaults_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_DefaultArgumentConstructorDefaults_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_DefaultArgumentConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_DefaultArgumentConstructorDefaults_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_Greeter_init") +@_cdecl("bjs_Greeter_init") +public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Greeter(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_greet") +@_cdecl("bjs_Greeter_greet") +public func _bjs_Greeter_greet(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).greet() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_changeName") +@_cdecl("bjs_Greeter_changeName") +public func _bjs_Greeter_changeName(_ _self: UnsafeMutableRawPointer, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + #if arch(wasm32) + Greeter.bridgeJSLiftParameter(_self).changeName(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_greetWith") +@_cdecl("bjs_Greeter_greetWith") +public func _bjs_Greeter_greetWith(_ _self: UnsafeMutableRawPointer, _ greeter: UnsafeMutableRawPointer, _ customGreeting: Int32) -> Void { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).greetWith(greeter: Greeter.bridgeJSLiftParameter(greeter), customGreeting: _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS.bridgeJSLift(customGreeting)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_makeFormatter") +@_cdecl("bjs_Greeter_makeFormatter") +public func _bjs_Greeter_makeFormatter(_ _self: UnsafeMutableRawPointer, _ suffixBytes: Int32, _ suffixLength: Int32) -> Int32 { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).makeFormatter(suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_static_makeCreator") +@_cdecl("bjs_Greeter_static_makeCreator") +public func _bjs_Greeter_static_makeCreator(_ defaultNameBytes: Int32, _ defaultNameLength: Int32) -> Int32 { + #if arch(wasm32) + let ret = Greeter.makeCreator(defaultName: String.bridgeJSLiftParameter(defaultNameBytes, defaultNameLength)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_makeCustomGreeter") +@_cdecl("bjs_Greeter_makeCustomGreeter") +public func _bjs_Greeter_makeCustomGreeter(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).makeCustomGreeter() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_greetEnthusiastically") +@_cdecl("bjs_Greeter_greetEnthusiastically") +public func _bjs_Greeter_greetEnthusiastically(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).greetEnthusiastically() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_static_greetAnonymously") +@_cdecl("bjs_Greeter_static_greetAnonymously") +public func _bjs_Greeter_static_greetAnonymously() -> Void { + #if arch(wasm32) + let ret = Greeter.greetAnonymously() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_name_get") +@_cdecl("bjs_Greeter_name_get") +public func _bjs_Greeter_name_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).name + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_name_set") +@_cdecl("bjs_Greeter_name_set") +public func _bjs_Greeter_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + Greeter.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_prefix_get") +@_cdecl("bjs_Greeter_prefix_get") +public func _bjs_Greeter_prefix_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).prefix + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_nameCount_get") +@_cdecl("bjs_Greeter_nameCount_get") +public func _bjs_Greeter_nameCount_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = Greeter.bridgeJSLiftParameter(_self).nameCount + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_static_defaultGreeting_get") +@_cdecl("bjs_Greeter_static_defaultGreeting_get") +public func _bjs_Greeter_static_defaultGreeting_get() -> Void { + #if arch(wasm32) + let ret = Greeter.defaultGreeting + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Greeter_deinit") +@_cdecl("bjs_Greeter_deinit") +public func _bjs_Greeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + public var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + public consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Greeter_wrap") +fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Greeter_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_Calculator_square") +@_cdecl("bjs_Calculator_square") +public func _bjs_Calculator_square(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Int32 { + #if arch(wasm32) + let ret = Calculator.bridgeJSLiftParameter(_self).square(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Calculator_add") +@_cdecl("bjs_Calculator_add") +public func _bjs_Calculator_add(_ _self: UnsafeMutableRawPointer, _ a: Int32, _ b: Int32) -> Int32 { + #if arch(wasm32) + let ret = Calculator.bridgeJSLiftParameter(_self).add(a: Int.bridgeJSLiftParameter(a), b: Int.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Calculator_deinit") +@_cdecl("bjs_Calculator_deinit") +public func _bjs_Calculator_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Calculator: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Calculator_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_Calculator_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Calculator_wrap") +fileprivate func _bjs_Calculator_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Calculator_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_Calculator_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Calculator_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_InternalGreeter_deinit") +@_cdecl("bjs_InternalGreeter_deinit") +public func _bjs_InternalGreeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension InternalGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + internal var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_InternalGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + internal consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_InternalGreeter_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_InternalGreeter_wrap") +fileprivate func _bjs_InternalGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_InternalGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_InternalGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_InternalGreeter_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_PublicGreeter_deinit") +@_cdecl("bjs_PublicGreeter_deinit") +public func _bjs_PublicGreeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension PublicGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + public var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_PublicGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + public consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_PublicGreeter_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PublicGreeter_wrap") +fileprivate func _bjs_PublicGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PublicGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_PublicGreeter_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_PackageGreeter_deinit") +@_cdecl("bjs_PackageGreeter_deinit") +public func _bjs_PackageGreeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension PackageGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + package var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_PackageGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + package consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_PackageGreeter_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PackageGreeter_wrap") +fileprivate func _bjs_PackageGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PackageGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_PackageGreeter_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_Utils_Converter_init") +@_cdecl("bjs_Utils_Converter_init") +public func _bjs_Utils_Converter_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Utils.Converter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Utils_Converter_toString") +@_cdecl("bjs_Utils_Converter_toString") +public func _bjs_Utils_Converter_toString(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + let ret = Utils.Converter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Utils_Converter_precision_get") +@_cdecl("bjs_Utils_Converter_precision_get") +public func _bjs_Utils_Converter_precision_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = Utils.Converter.bridgeJSLiftParameter(_self).precision + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Utils_Converter_precision_set") +@_cdecl("bjs_Utils_Converter_precision_set") +public func _bjs_Utils_Converter_precision_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + Utils.Converter.bridgeJSLiftParameter(_self).precision = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Utils_Converter_deinit") +@_cdecl("bjs_Utils_Converter_deinit") +public func _bjs_Utils_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Utils_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_Utils_Converter_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Utils_Converter_wrap") +fileprivate func _bjs_Utils_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Utils_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_Utils_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Utils_Converter_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_Networking_API_HTTPServer_init") +@_cdecl("bjs_Networking_API_HTTPServer_init") +public func _bjs_Networking_API_HTTPServer_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Networking.API.HTTPServer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Networking_API_HTTPServer_call") +@_cdecl("bjs_Networking_API_HTTPServer_call") +public func _bjs_Networking_API_HTTPServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { + #if arch(wasm32) + Networking.API.HTTPServer.bridgeJSLiftParameter(_self).call(_: Networking.API.Method.bridgeJSLiftParameter(method)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Networking_API_HTTPServer_deinit") +@_cdecl("bjs_Networking_API_HTTPServer_deinit") +public func _bjs_Networking_API_HTTPServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Networking_API_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_Networking_API_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Networking_API_HTTPServer_wrap") +fileprivate func _bjs_Networking_API_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Networking_API_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_Networking_API_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Networking_API_HTTPServer_wrap_extern(pointer) +} + +@_expose(wasm, "bjs___Swift_Foundation_UUID_init") +@_cdecl("bjs___Swift_Foundation_UUID_init") +public func _bjs___Swift_Foundation_UUID_init(_ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = UUID(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs___Swift_Foundation_UUID_uuidString") +@_cdecl("bjs___Swift_Foundation_UUID_uuidString") +public func _bjs___Swift_Foundation_UUID_uuidString(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = UUID.bridgeJSLiftParameter(_self).uuidString() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs___Swift_Foundation_UUID_static_fromValue") +@_cdecl("bjs___Swift_Foundation_UUID_static_fromValue") +public func _bjs___Swift_Foundation_UUID_static_fromValue(_ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = UUID.fromValue(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs___Swift_Foundation_UUID_static_placeholder_get") +@_cdecl("bjs___Swift_Foundation_UUID_static_placeholder_get") +public func _bjs___Swift_Foundation_UUID_static_placeholder_get() -> Void { + #if arch(wasm32) + let ret = UUID.placeholder + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs___Swift_Foundation_UUID_deinit") +@_cdecl("bjs___Swift_Foundation_UUID_deinit") +public func _bjs___Swift_Foundation_UUID_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs___Swift_Foundation_UUID_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs___Swift_Foundation_UUID_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs___Swift_Foundation_UUID_wrap") +fileprivate func _bjs___Swift_Foundation_UUID_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs___Swift_Foundation_UUID_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs___Swift_Foundation_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs___Swift_Foundation_UUID_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_Networking_APIV2_Internal_TestServer_init") +@_cdecl("bjs_Networking_APIV2_Internal_TestServer_init") +public func _bjs_Networking_APIV2_Internal_TestServer_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = Internal.TestServer() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Networking_APIV2_Internal_TestServer_call") +@_cdecl("bjs_Networking_APIV2_Internal_TestServer_call") +public func _bjs_Networking_APIV2_Internal_TestServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { + #if arch(wasm32) + Internal.TestServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Networking_APIV2_Internal_TestServer_deinit") +@_cdecl("bjs_Networking_APIV2_Internal_TestServer_deinit") +public func _bjs_Networking_APIV2_Internal_TestServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Networking_APIV2_Internal_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_Networking_APIV2_Internal_TestServer_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Networking_APIV2_Internal_TestServer_wrap") +fileprivate func _bjs_Networking_APIV2_Internal_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Networking_APIV2_Internal_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_Networking_APIV2_Internal_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Networking_APIV2_Internal_TestServer_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_SimplePropertyHolder_init") +@_cdecl("bjs_SimplePropertyHolder_init") +public func _bjs_SimplePropertyHolder_init(_ value: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = SimplePropertyHolder(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimplePropertyHolder_value_get") +@_cdecl("bjs_SimplePropertyHolder_value_get") +public func _bjs_SimplePropertyHolder_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SimplePropertyHolder.bridgeJSLiftParameter(_self).value + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimplePropertyHolder_value_set") +@_cdecl("bjs_SimplePropertyHolder_value_set") +public func _bjs_SimplePropertyHolder_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + SimplePropertyHolder.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimplePropertyHolder_deinit") +@_cdecl("bjs_SimplePropertyHolder_deinit") +public func _bjs_SimplePropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension SimplePropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_SimplePropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_SimplePropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SimplePropertyHolder_wrap") +fileprivate func _bjs_SimplePropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_SimplePropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_SimplePropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_SimplePropertyHolder_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_PropertyHolder_init") +@_cdecl("bjs_PropertyHolder_init") +public func _bjs_PropertyHolder_init(_ intValue: Int32, _ floatValue: Float32, _ doubleValue: Float64, _ boolValue: Int32, _ stringValueBytes: Int32, _ stringValueLength: Int32, _ jsObject: Int32, _ sibling: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = PropertyHolder(intValue: Int.bridgeJSLiftParameter(intValue), floatValue: Float.bridgeJSLiftParameter(floatValue), doubleValue: Double.bridgeJSLiftParameter(doubleValue), boolValue: Bool.bridgeJSLiftParameter(boolValue), stringValue: String.bridgeJSLiftParameter(stringValueBytes, stringValueLength), jsObject: JSObject.bridgeJSLiftParameter(jsObject), sibling: SimplePropertyHolder.bridgeJSLiftParameter(sibling)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_getAllValues") +@_cdecl("bjs_PropertyHolder_getAllValues") +public func _bjs_PropertyHolder_getAllValues(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).getAllValues() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_intValue_get") +@_cdecl("bjs_PropertyHolder_intValue_get") +public func _bjs_PropertyHolder_intValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).intValue + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_intValue_set") +@_cdecl("bjs_PropertyHolder_intValue_set") +public func _bjs_PropertyHolder_intValue_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).intValue = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_floatValue_get") +@_cdecl("bjs_PropertyHolder_floatValue_get") +public func _bjs_PropertyHolder_floatValue_get(_ _self: UnsafeMutableRawPointer) -> Float32 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).floatValue + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_floatValue_set") +@_cdecl("bjs_PropertyHolder_floatValue_set") +public func _bjs_PropertyHolder_floatValue_set(_ _self: UnsafeMutableRawPointer, _ value: Float32) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).floatValue = Float.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_doubleValue_get") +@_cdecl("bjs_PropertyHolder_doubleValue_get") +public func _bjs_PropertyHolder_doubleValue_get(_ _self: UnsafeMutableRawPointer) -> Float64 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).doubleValue + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_doubleValue_set") +@_cdecl("bjs_PropertyHolder_doubleValue_set") +public func _bjs_PropertyHolder_doubleValue_set(_ _self: UnsafeMutableRawPointer, _ value: Float64) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).doubleValue = Double.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_boolValue_get") +@_cdecl("bjs_PropertyHolder_boolValue_get") +public func _bjs_PropertyHolder_boolValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).boolValue + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_boolValue_set") +@_cdecl("bjs_PropertyHolder_boolValue_set") +public func _bjs_PropertyHolder_boolValue_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).boolValue = Bool.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_stringValue_get") +@_cdecl("bjs_PropertyHolder_stringValue_get") +public func _bjs_PropertyHolder_stringValue_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).stringValue + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_stringValue_set") +@_cdecl("bjs_PropertyHolder_stringValue_set") +public func _bjs_PropertyHolder_stringValue_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).stringValue = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_readonlyInt_get") +@_cdecl("bjs_PropertyHolder_readonlyInt_get") +public func _bjs_PropertyHolder_readonlyInt_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyInt + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_readonlyFloat_get") +@_cdecl("bjs_PropertyHolder_readonlyFloat_get") +public func _bjs_PropertyHolder_readonlyFloat_get(_ _self: UnsafeMutableRawPointer) -> Float32 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyFloat + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_readonlyDouble_get") +@_cdecl("bjs_PropertyHolder_readonlyDouble_get") +public func _bjs_PropertyHolder_readonlyDouble_get(_ _self: UnsafeMutableRawPointer) -> Float64 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyDouble + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_readonlyBool_get") +@_cdecl("bjs_PropertyHolder_readonlyBool_get") +public func _bjs_PropertyHolder_readonlyBool_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyBool + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_readonlyString_get") +@_cdecl("bjs_PropertyHolder_readonlyString_get") +public func _bjs_PropertyHolder_readonlyString_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyString + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_jsObject_get") +@_cdecl("bjs_PropertyHolder_jsObject_get") +public func _bjs_PropertyHolder_jsObject_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).jsObject + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_jsObject_set") +@_cdecl("bjs_PropertyHolder_jsObject_set") +public func _bjs_PropertyHolder_jsObject_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).jsObject = JSObject.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_sibling_get") +@_cdecl("bjs_PropertyHolder_sibling_get") +public func _bjs_PropertyHolder_sibling_get(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).sibling + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_sibling_set") +@_cdecl("bjs_PropertyHolder_sibling_set") +public func _bjs_PropertyHolder_sibling_set(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).sibling = SimplePropertyHolder.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_lazyValue_get") +@_cdecl("bjs_PropertyHolder_lazyValue_get") +public func _bjs_PropertyHolder_lazyValue_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).lazyValue + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_lazyValue_set") +@_cdecl("bjs_PropertyHolder_lazyValue_set") +public func _bjs_PropertyHolder_lazyValue_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).lazyValue = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_computedReadonly_get") +@_cdecl("bjs_PropertyHolder_computedReadonly_get") +public func _bjs_PropertyHolder_computedReadonly_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).computedReadonly + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_computedReadWrite_get") +@_cdecl("bjs_PropertyHolder_computedReadWrite_get") +public func _bjs_PropertyHolder_computedReadWrite_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).computedReadWrite + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_computedReadWrite_set") +@_cdecl("bjs_PropertyHolder_computedReadWrite_set") +public func _bjs_PropertyHolder_computedReadWrite_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).computedReadWrite = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_observedProperty_get") +@_cdecl("bjs_PropertyHolder_observedProperty_get") +public func _bjs_PropertyHolder_observedProperty_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = PropertyHolder.bridgeJSLiftParameter(_self).observedProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_observedProperty_set") +@_cdecl("bjs_PropertyHolder_observedProperty_set") +public func _bjs_PropertyHolder_observedProperty_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + PropertyHolder.bridgeJSLiftParameter(_self).observedProperty = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PropertyHolder_deinit") +@_cdecl("bjs_PropertyHolder_deinit") +public func _bjs_PropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension PropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_PropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_PropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PropertyHolder_wrap") +fileprivate func _bjs_PropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_PropertyHolder_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_MathUtils_static_add") +@_cdecl("bjs_MathUtils_static_add") +public func _bjs_MathUtils_static_add(_ a: Int32, _ b: Int32) -> Int32 { + #if arch(wasm32) + let ret = MathUtils.add(a: Int.bridgeJSLiftParameter(a), b: Int.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MathUtils_static_substract") +@_cdecl("bjs_MathUtils_static_substract") +public func _bjs_MathUtils_static_substract(_ a: Int32, _ b: Int32) -> Int32 { + #if arch(wasm32) + let ret = MathUtils.substract(a: Int.bridgeJSLiftParameter(a), b: Int.bridgeJSLiftParameter(b)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_MathUtils_deinit") +@_cdecl("bjs_MathUtils_deinit") +public func _bjs_MathUtils_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_MathUtils_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_MathUtils_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MathUtils_wrap") +fileprivate func _bjs_MathUtils_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_MathUtils_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_MathUtils_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_StaticPropertyHolder_init") +@_cdecl("bjs_StaticPropertyHolder_init") +public func _bjs_StaticPropertyHolder_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = StaticPropertyHolder() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticConstant_get") +@_cdecl("bjs_StaticPropertyHolder_static_staticConstant_get") +public func _bjs_StaticPropertyHolder_static_staticConstant_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyHolder.staticConstant + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticVariable_get") +@_cdecl("bjs_StaticPropertyHolder_static_staticVariable_get") +public func _bjs_StaticPropertyHolder_static_staticVariable_get() -> Int32 { + #if arch(wasm32) + let ret = StaticPropertyHolder.staticVariable + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticVariable_set") +@_cdecl("bjs_StaticPropertyHolder_static_staticVariable_set") +public func _bjs_StaticPropertyHolder_static_staticVariable_set(_ value: Int32) -> Void { + #if arch(wasm32) + StaticPropertyHolder.staticVariable = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticString_get") +@_cdecl("bjs_StaticPropertyHolder_static_staticString_get") +public func _bjs_StaticPropertyHolder_static_staticString_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyHolder.staticString + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticString_set") +@_cdecl("bjs_StaticPropertyHolder_static_staticString_set") +public func _bjs_StaticPropertyHolder_static_staticString_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + StaticPropertyHolder.staticString = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticBool_get") +@_cdecl("bjs_StaticPropertyHolder_static_staticBool_get") +public func _bjs_StaticPropertyHolder_static_staticBool_get() -> Int32 { + #if arch(wasm32) + let ret = StaticPropertyHolder.staticBool + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticBool_set") +@_cdecl("bjs_StaticPropertyHolder_static_staticBool_set") +public func _bjs_StaticPropertyHolder_static_staticBool_set(_ value: Int32) -> Void { + #if arch(wasm32) + StaticPropertyHolder.staticBool = Bool.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticFloat_get") +@_cdecl("bjs_StaticPropertyHolder_static_staticFloat_get") +public func _bjs_StaticPropertyHolder_static_staticFloat_get() -> Float32 { + #if arch(wasm32) + let ret = StaticPropertyHolder.staticFloat + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticFloat_set") +@_cdecl("bjs_StaticPropertyHolder_static_staticFloat_set") +public func _bjs_StaticPropertyHolder_static_staticFloat_set(_ value: Float32) -> Void { + #if arch(wasm32) + StaticPropertyHolder.staticFloat = Float.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticDouble_get") +@_cdecl("bjs_StaticPropertyHolder_static_staticDouble_get") +public func _bjs_StaticPropertyHolder_static_staticDouble_get() -> Float64 { + #if arch(wasm32) + let ret = StaticPropertyHolder.staticDouble + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_staticDouble_set") +@_cdecl("bjs_StaticPropertyHolder_static_staticDouble_set") +public func _bjs_StaticPropertyHolder_static_staticDouble_set(_ value: Float64) -> Void { + #if arch(wasm32) + StaticPropertyHolder.staticDouble = Double.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_computedProperty_get") +@_cdecl("bjs_StaticPropertyHolder_static_computedProperty_get") +public func _bjs_StaticPropertyHolder_static_computedProperty_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyHolder.computedProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_computedProperty_set") +@_cdecl("bjs_StaticPropertyHolder_static_computedProperty_set") +public func _bjs_StaticPropertyHolder_static_computedProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + StaticPropertyHolder.computedProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_readOnlyComputed_get") +@_cdecl("bjs_StaticPropertyHolder_static_readOnlyComputed_get") +public func _bjs_StaticPropertyHolder_static_readOnlyComputed_get() -> Int32 { + #if arch(wasm32) + let ret = StaticPropertyHolder.readOnlyComputed + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_optionalString_get") +@_cdecl("bjs_StaticPropertyHolder_static_optionalString_get") +public func _bjs_StaticPropertyHolder_static_optionalString_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyHolder.optionalString + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_optionalString_set") +@_cdecl("bjs_StaticPropertyHolder_static_optionalString_set") +public func _bjs_StaticPropertyHolder_static_optionalString_set(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + StaticPropertyHolder.optionalString = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_optionalInt_get") +@_cdecl("bjs_StaticPropertyHolder_static_optionalInt_get") +public func _bjs_StaticPropertyHolder_static_optionalInt_get() -> Void { + #if arch(wasm32) + let ret = StaticPropertyHolder.optionalInt + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_optionalInt_set") +@_cdecl("bjs_StaticPropertyHolder_static_optionalInt_set") +public func _bjs_StaticPropertyHolder_static_optionalInt_set(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + StaticPropertyHolder.optionalInt = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_jsObjectProperty_get") +@_cdecl("bjs_StaticPropertyHolder_static_jsObjectProperty_get") +public func _bjs_StaticPropertyHolder_static_jsObjectProperty_get() -> Int32 { + #if arch(wasm32) + let ret = StaticPropertyHolder.jsObjectProperty + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_static_jsObjectProperty_set") +@_cdecl("bjs_StaticPropertyHolder_static_jsObjectProperty_set") +public func _bjs_StaticPropertyHolder_static_jsObjectProperty_set(_ value: Int32) -> Void { + #if arch(wasm32) + StaticPropertyHolder.jsObjectProperty = JSObject.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_StaticPropertyHolder_deinit") +@_cdecl("bjs_StaticPropertyHolder_deinit") +public func _bjs_StaticPropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension StaticPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_StaticPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_StaticPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticPropertyHolder_wrap") +fileprivate func _bjs_StaticPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_StaticPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_StaticPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_StaticPropertyHolder_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_DataProcessorManager_init") +@_cdecl("bjs_DataProcessorManager_init") +public func _bjs_DataProcessorManager_init(_ processor: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = DataProcessorManager(processor: AnyDataProcessor.bridgeJSLiftParameter(processor)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_incrementByAmount") +@_cdecl("bjs_DataProcessorManager_incrementByAmount") +public func _bjs_DataProcessorManager_incrementByAmount(_ _self: UnsafeMutableRawPointer, _ amount: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_setProcessorLabel") +@_cdecl("bjs_DataProcessorManager_setProcessorLabel") +public func _bjs_DataProcessorManager_setProcessorLabel(_ _self: UnsafeMutableRawPointer, _ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_isProcessorEven") +@_cdecl("bjs_DataProcessorManager_isProcessorEven") +public func _bjs_DataProcessorManager_isProcessorEven(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).isProcessorEven() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_getProcessorLabel") +@_cdecl("bjs_DataProcessorManager_getProcessorLabel") +public func _bjs_DataProcessorManager_getProcessorLabel(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorLabel() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_getCurrentValue") +@_cdecl("bjs_DataProcessorManager_getCurrentValue") +public func _bjs_DataProcessorManager_getCurrentValue(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getCurrentValue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_incrementBoth") +@_cdecl("bjs_DataProcessorManager_incrementBoth") +public func _bjs_DataProcessorManager_incrementBoth(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).incrementBoth() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_getBackupValue") +@_cdecl("bjs_DataProcessorManager_getBackupValue") +public func _bjs_DataProcessorManager_getBackupValue(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getBackupValue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_hasBackup") +@_cdecl("bjs_DataProcessorManager_hasBackup") +public func _bjs_DataProcessorManager_hasBackup(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).hasBackup() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_getProcessorOptionalTag") +@_cdecl("bjs_DataProcessorManager_getProcessorOptionalTag") +public func _bjs_DataProcessorManager_getProcessorOptionalTag(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorOptionalTag() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_setProcessorOptionalTag") +@_cdecl("bjs_DataProcessorManager_setProcessorOptionalTag") +public func _bjs_DataProcessorManager_setProcessorOptionalTag(_ _self: UnsafeMutableRawPointer, _ tagIsSome: Int32, _ tagBytes: Int32, _ tagLength: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorOptionalTag(_: Optional.bridgeJSLiftParameter(tagIsSome, tagBytes, tagLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_getProcessorOptionalCount") +@_cdecl("bjs_DataProcessorManager_getProcessorOptionalCount") +public func _bjs_DataProcessorManager_getProcessorOptionalCount(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorOptionalCount() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_setProcessorOptionalCount") +@_cdecl("bjs_DataProcessorManager_setProcessorOptionalCount") +public func _bjs_DataProcessorManager_setProcessorOptionalCount(_ _self: UnsafeMutableRawPointer, _ countIsSome: Int32, _ countValue: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorOptionalCount(_: Optional.bridgeJSLiftParameter(countIsSome, countValue)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_getProcessorDirection") +@_cdecl("bjs_DataProcessorManager_getProcessorDirection") +public func _bjs_DataProcessorManager_getProcessorDirection(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorDirection() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_setProcessorDirection") +@_cdecl("bjs_DataProcessorManager_setProcessorDirection") +public func _bjs_DataProcessorManager_setProcessorDirection(_ _self: UnsafeMutableRawPointer, _ directionIsSome: Int32, _ directionValue: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorDirection(_: Optional.bridgeJSLiftParameter(directionIsSome, directionValue)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_getProcessorTheme") +@_cdecl("bjs_DataProcessorManager_getProcessorTheme") +public func _bjs_DataProcessorManager_getProcessorTheme(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorTheme() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_setProcessorTheme") +@_cdecl("bjs_DataProcessorManager_setProcessorTheme") +public func _bjs_DataProcessorManager_setProcessorTheme(_ _self: UnsafeMutableRawPointer, _ themeIsSome: Int32, _ themeBytes: Int32, _ themeLength: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorTheme(_: Optional.bridgeJSLiftParameter(themeIsSome, themeBytes, themeLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_getProcessorHttpStatus") +@_cdecl("bjs_DataProcessorManager_getProcessorHttpStatus") +public func _bjs_DataProcessorManager_getProcessorHttpStatus(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorHttpStatus() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_setProcessorHttpStatus") +@_cdecl("bjs_DataProcessorManager_setProcessorHttpStatus") +public func _bjs_DataProcessorManager_setProcessorHttpStatus(_ _self: UnsafeMutableRawPointer, _ statusIsSome: Int32, _ statusValue: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorHttpStatus(_: Optional.bridgeJSLiftParameter(statusIsSome, statusValue)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_getProcessorAPIResult") +@_cdecl("bjs_DataProcessorManager_getProcessorAPIResult") +public func _bjs_DataProcessorManager_getProcessorAPIResult(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorAPIResult() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_setProcessorAPIResult") +@_cdecl("bjs_DataProcessorManager_setProcessorAPIResult") +public func _bjs_DataProcessorManager_setProcessorAPIResult(_ _self: UnsafeMutableRawPointer, _ apiResultIsSome: Int32, _ apiResultCaseId: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorAPIResult(_: Optional.bridgeJSLiftParameter(apiResultIsSome, apiResultCaseId)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_processor_get") +@_cdecl("bjs_DataProcessorManager_processor_get") +public func _bjs_DataProcessorManager_processor_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).processor as! _BridgedSwiftProtocolExportable + return ret.bridgeJSLowerAsProtocolReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_processor_set") +@_cdecl("bjs_DataProcessorManager_processor_set") +public func _bjs_DataProcessorManager_processor_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).processor = AnyDataProcessor.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_backupProcessor_get") +@_cdecl("bjs_DataProcessorManager_backupProcessor_get") +public func _bjs_DataProcessorManager_backupProcessor_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor + if let ret { + _swift_js_return_optional_object(1, (ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) + } else { + _swift_js_return_optional_object(0, 0) + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_backupProcessor_set") +@_cdecl("bjs_DataProcessorManager_backupProcessor_set") +public func _bjs_DataProcessorManager_backupProcessor_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_DataProcessorManager_deinit") +@_cdecl("bjs_DataProcessorManager_deinit") +public func _bjs_DataProcessorManager_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension DataProcessorManager: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_DataProcessorManager_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_DataProcessorManager_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessorManager_wrap") +fileprivate func _bjs_DataProcessorManager_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_DataProcessorManager_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_DataProcessorManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_DataProcessorManager_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_SwiftDataProcessor_init") +@_cdecl("bjs_SwiftDataProcessor_init") +public func _bjs_SwiftDataProcessor_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = SwiftDataProcessor() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_increment") +@_cdecl("bjs_SwiftDataProcessor_increment") +public func _bjs_SwiftDataProcessor_increment(_ _self: UnsafeMutableRawPointer, _ amount: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).increment(by: Int.bridgeJSLiftParameter(amount)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_getValue") +@_cdecl("bjs_SwiftDataProcessor_getValue") +public func _bjs_SwiftDataProcessor_getValue(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getValue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_setLabelElements") +@_cdecl("bjs_SwiftDataProcessor_setLabelElements") +public func _bjs_SwiftDataProcessor_setLabelElements(_ _self: UnsafeMutableRawPointer, _ labelPrefixBytes: Int32, _ labelPrefixLength: Int32, _ labelSuffixBytes: Int32, _ labelSuffixLength: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).setLabelElements(_: String.bridgeJSLiftParameter(labelPrefixBytes, labelPrefixLength), _: String.bridgeJSLiftParameter(labelSuffixBytes, labelSuffixLength)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_getLabel") +@_cdecl("bjs_SwiftDataProcessor_getLabel") +public func _bjs_SwiftDataProcessor_getLabel(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getLabel() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_isEven") +@_cdecl("bjs_SwiftDataProcessor_isEven") +public func _bjs_SwiftDataProcessor_isEven(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).isEven() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_processGreeter") +@_cdecl("bjs_SwiftDataProcessor_processGreeter") +public func _bjs_SwiftDataProcessor_processGreeter(_ _self: UnsafeMutableRawPointer, _ greeter: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).processGreeter(_: Greeter.bridgeJSLiftParameter(greeter)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_createGreeter") +@_cdecl("bjs_SwiftDataProcessor_createGreeter") +public func _bjs_SwiftDataProcessor_createGreeter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).createGreeter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_processOptionalGreeter") +@_cdecl("bjs_SwiftDataProcessor_processOptionalGreeter") +public func _bjs_SwiftDataProcessor_processOptionalGreeter(_ _self: UnsafeMutableRawPointer, _ greeterIsSome: Int32, _ greeterValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).processOptionalGreeter(_: Optional.bridgeJSLiftParameter(greeterIsSome, greeterValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_createOptionalGreeter") +@_cdecl("bjs_SwiftDataProcessor_createOptionalGreeter") +public func _bjs_SwiftDataProcessor_createOptionalGreeter(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).createOptionalGreeter() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_handleAPIResult") +@_cdecl("bjs_SwiftDataProcessor_handleAPIResult") +public func _bjs_SwiftDataProcessor_handleAPIResult(_ _self: UnsafeMutableRawPointer, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).handleAPIResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_getAPIResult") +@_cdecl("bjs_SwiftDataProcessor_getAPIResult") +public func _bjs_SwiftDataProcessor_getAPIResult(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getAPIResult() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_count_get") +@_cdecl("bjs_SwiftDataProcessor_count_get") +public func _bjs_SwiftDataProcessor_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).count + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_count_set") +@_cdecl("bjs_SwiftDataProcessor_count_set") +public func _bjs_SwiftDataProcessor_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_name_get") +@_cdecl("bjs_SwiftDataProcessor_name_get") +public func _bjs_SwiftDataProcessor_name_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).name + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_optionalTag_get") +@_cdecl("bjs_SwiftDataProcessor_optionalTag_get") +public func _bjs_SwiftDataProcessor_optionalTag_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_optionalTag_set") +@_cdecl("bjs_SwiftDataProcessor_optionalTag_set") +public func _bjs_SwiftDataProcessor_optionalTag_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTag = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_optionalCount_get") +@_cdecl("bjs_SwiftDataProcessor_optionalCount_get") +public func _bjs_SwiftDataProcessor_optionalCount_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalCount + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_optionalCount_set") +@_cdecl("bjs_SwiftDataProcessor_optionalCount_set") +public func _bjs_SwiftDataProcessor_optionalCount_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalCount = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_direction_get") +@_cdecl("bjs_SwiftDataProcessor_direction_get") +public func _bjs_SwiftDataProcessor_direction_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).direction + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_direction_set") +@_cdecl("bjs_SwiftDataProcessor_direction_set") +public func _bjs_SwiftDataProcessor_direction_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).direction = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_optionalTheme_get") +@_cdecl("bjs_SwiftDataProcessor_optionalTheme_get") +public func _bjs_SwiftDataProcessor_optionalTheme_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTheme + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_optionalTheme_set") +@_cdecl("bjs_SwiftDataProcessor_optionalTheme_set") +public func _bjs_SwiftDataProcessor_optionalTheme_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTheme = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_httpStatus_get") +@_cdecl("bjs_SwiftDataProcessor_httpStatus_get") +public func _bjs_SwiftDataProcessor_httpStatus_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).httpStatus + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_httpStatus_set") +@_cdecl("bjs_SwiftDataProcessor_httpStatus_set") +public func _bjs_SwiftDataProcessor_httpStatus_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).httpStatus = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_apiResult_get") +@_cdecl("bjs_SwiftDataProcessor_apiResult_get") +public func _bjs_SwiftDataProcessor_apiResult_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).apiResult + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_apiResult_set") +@_cdecl("bjs_SwiftDataProcessor_apiResult_set") +public func _bjs_SwiftDataProcessor_apiResult_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueCaseId: Int32) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).apiResult = Optional.bridgeJSLiftParameter(valueIsSome, valueCaseId) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_helper_get") +@_cdecl("bjs_SwiftDataProcessor_helper_get") +public func _bjs_SwiftDataProcessor_helper_get(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).helper + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_helper_set") +@_cdecl("bjs_SwiftDataProcessor_helper_set") +public func _bjs_SwiftDataProcessor_helper_set(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).helper = Greeter.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_optionalHelper_get") +@_cdecl("bjs_SwiftDataProcessor_optionalHelper_get") +public func _bjs_SwiftDataProcessor_optionalHelper_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalHelper + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_optionalHelper_set") +@_cdecl("bjs_SwiftDataProcessor_optionalHelper_set") +public func _bjs_SwiftDataProcessor_optionalHelper_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalHelper = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SwiftDataProcessor_deinit") +@_cdecl("bjs_SwiftDataProcessor_deinit") +public func _bjs_SwiftDataProcessor_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension SwiftDataProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_SwiftDataProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_SwiftDataProcessor_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftDataProcessor_wrap") +fileprivate func _bjs_SwiftDataProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_SwiftDataProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_SwiftDataProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_SwiftDataProcessor_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessor") +@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessor") +public func _bjs_ProtocolReturnTests_static_createNativeProcessor() -> Int32 { + #if arch(wasm32) + let ret = ProtocolReturnTests.createNativeProcessor() as! _BridgedSwiftProtocolExportable + return ret.bridgeJSLowerAsProtocolReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessorOptional") +@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessorOptional") +public func _bjs_ProtocolReturnTests_static_createNativeProcessorOptional() -> Void { + #if arch(wasm32) + let ret = ProtocolReturnTests.createNativeProcessorOptional() + if let ret { + _swift_js_return_optional_object(1, (ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) + } else { + _swift_js_return_optional_object(0, 0) + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessorNil") +@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessorNil") +public func _bjs_ProtocolReturnTests_static_createNativeProcessorNil() -> Void { + #if arch(wasm32) + let ret = ProtocolReturnTests.createNativeProcessorNil() + if let ret { + _swift_js_return_optional_object(1, (ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) + } else { + _swift_js_return_optional_object(0, 0) + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessorArray") +@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessorArray") +public func _bjs_ProtocolReturnTests_static_createNativeProcessorArray() -> Void { + #if arch(wasm32) + let ret = ProtocolReturnTests.createNativeProcessorArray() + for __bjs_elem_ret in ret { + _swift_js_push_i32((__bjs_elem_ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) + } + _swift_js_push_i32(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessorDictionary") +@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessorDictionary") +public func _bjs_ProtocolReturnTests_static_createNativeProcessorDictionary() -> Void { + #if arch(wasm32) + let ret = ProtocolReturnTests.createNativeProcessorDictionary() + for __bjs_kv_ret in ret { + __bjs_kv_ret.key.bridgeJSStackPush() + _swift_js_push_i32((__bjs_kv_ret.value as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) + } + _swift_js_push_i32(Int32(ret.count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ProtocolReturnTests_deinit") +@_cdecl("bjs_ProtocolReturnTests_deinit") +public func _bjs_ProtocolReturnTests_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension ProtocolReturnTests: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ProtocolReturnTests_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_ProtocolReturnTests_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ProtocolReturnTests_wrap") +fileprivate func _bjs_ProtocolReturnTests_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ProtocolReturnTests_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_ProtocolReturnTests_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ProtocolReturnTests_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_TextProcessor_init") +@_cdecl("bjs_TextProcessor_init") +public func _bjs_TextProcessor_init(_ transform: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = TextProcessor(transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_process") +@_cdecl("bjs_TextProcessor_process") +public func _bjs_TextProcessor_process(_ _self: UnsafeMutableRawPointer, _ textBytes: Int32, _ textLength: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).process(_: String.bridgeJSLiftParameter(textBytes, textLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processWithCustom") +@_cdecl("bjs_TextProcessor_processWithCustom") +public func _bjs_TextProcessor_processWithCustom(_ _self: UnsafeMutableRawPointer, _ textBytes: Int32, _ textLength: Int32, _ customTransform: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processWithCustom(_: String.bridgeJSLiftParameter(textBytes, textLength), customTransform: _BJS_Closure_20BridgeJSRuntimeTestsSiSSSd_SS.bridgeJSLift(customTransform)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_getTransform") +@_cdecl("bjs_TextProcessor_getTransform") +public func _bjs_TextProcessor_getTransform(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).getTransform() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalString") +@_cdecl("bjs_TextProcessor_processOptionalString") +public func _bjs_TextProcessor_processOptionalString(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalString(_: _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalInt") +@_cdecl("bjs_TextProcessor_processOptionalInt") +public func _bjs_TextProcessor_processOptionalInt(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalInt(_: _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalGreeter") +@_cdecl("bjs_TextProcessor_processOptionalGreeter") +public func _bjs_TextProcessor_processOptionalGreeter(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalGreeter(_: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeOptionalStringFormatter") +@_cdecl("bjs_TextProcessor_makeOptionalStringFormatter") +public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeOptionalGreeterCreator") +@_cdecl("bjs_TextProcessor_makeOptionalGreeterCreator") +public func _bjs_TextProcessor_makeOptionalGreeterCreator(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processDirection") +@_cdecl("bjs_TextProcessor_processDirection") +public func _bjs_TextProcessor_processDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processTheme") +@_cdecl("bjs_TextProcessor_processTheme") +public func _bjs_TextProcessor_processTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processHttpStatus") +@_cdecl("bjs_TextProcessor_processHttpStatus") +public func _bjs_TextProcessor_processHttpStatus(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processAPIResult") +@_cdecl("bjs_TextProcessor_processAPIResult") +public func _bjs_TextProcessor_processAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeDirectionChecker") +@_cdecl("bjs_TextProcessor_makeDirectionChecker") +public func _bjs_TextProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeThemeValidator") +@_cdecl("bjs_TextProcessor_makeThemeValidator") +public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeStatusCodeExtractor") +@_cdecl("bjs_TextProcessor_makeStatusCodeExtractor") +public func _bjs_TextProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeAPIResultHandler") +@_cdecl("bjs_TextProcessor_makeAPIResultHandler") +public func _bjs_TextProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalDirection") +@_cdecl("bjs_TextProcessor_processOptionalDirection") +public func _bjs_TextProcessor_processOptionalDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalTheme") +@_cdecl("bjs_TextProcessor_processOptionalTheme") +public func _bjs_TextProcessor_processOptionalTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalAPIResult") +@_cdecl("bjs_TextProcessor_processOptionalAPIResult") +public func _bjs_TextProcessor_processOptionalAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeOptionalDirectionFormatter") +@_cdecl("bjs_TextProcessor_makeOptionalDirectionFormatter") +public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processDataProcessor") +@_cdecl("bjs_TextProcessor_processDataProcessor") +public func _bjs_TextProcessor_processDataProcessor(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processDataProcessor(_: _BJS_Closure_20BridgeJSRuntimeTests13DataProcessorP_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_makeDataProcessorFactory") +@_cdecl("bjs_TextProcessor_makeDataProcessorFactory") +public func _bjs_TextProcessor_makeDataProcessorFactory(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDataProcessorFactory() + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_roundtripDataProcessor") +@_cdecl("bjs_TextProcessor_roundtripDataProcessor") +public func _bjs_TextProcessor_roundtripDataProcessor(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Int32 { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).roundtripDataProcessor(_: _BJS_Closure_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP.bridgeJSLift(callback)) + return JSTypedClosure(ret).bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_processOptionalDataProcessor") +@_cdecl("bjs_TextProcessor_processOptionalDataProcessor") +public func _bjs_TextProcessor_processOptionalDataProcessor(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { + #if arch(wasm32) + let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalDataProcessor(_: _BJS_Closure_20BridgeJSRuntimeTestsSq13DataProcessorP_SS.bridgeJSLift(callback)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_TextProcessor_deinit") +@_cdecl("bjs_TextProcessor_deinit") +public func _bjs_TextProcessor_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") +fileprivate func _bjs_TextProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_TextProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_TextProcessor_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_IdentityTestSubject_init") +@_cdecl("bjs_IdentityTestSubject_init") +public func _bjs_IdentityTestSubject_init(_ value: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = IdentityTestSubject(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityTestSubject_value_get") +@_cdecl("bjs_IdentityTestSubject_value_get") +public func _bjs_IdentityTestSubject_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).value + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityTestSubject_value_set") +@_cdecl("bjs_IdentityTestSubject_value_set") +public func _bjs_IdentityTestSubject_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + IdentityTestSubject.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityTestSubject_currentValue_get") +@_cdecl("bjs_IdentityTestSubject_currentValue_get") +public func _bjs_IdentityTestSubject_currentValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).currentValue + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityTestSubject_deinit") +@_cdecl("bjs_IdentityTestSubject_deinit") +public func _bjs_IdentityTestSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension IdentityTestSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IdentityTestSubject_wrap") +fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_IdentityTestSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_IdentityTestSubject_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_RetainLeakSubject_init") +@_cdecl("bjs_RetainLeakSubject_init") +public func _bjs_RetainLeakSubject_init(_ tag: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = RetainLeakSubject(tag: Int.bridgeJSLiftParameter(tag)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_RetainLeakSubject_tag_get") +@_cdecl("bjs_RetainLeakSubject_tag_get") +public func _bjs_RetainLeakSubject_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = RetainLeakSubject.bridgeJSLiftParameter(_self).tag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_RetainLeakSubject_tag_set") +@_cdecl("bjs_RetainLeakSubject_tag_set") +public func _bjs_RetainLeakSubject_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + RetainLeakSubject.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_RetainLeakSubject_deinit") +@_cdecl("bjs_RetainLeakSubject_deinit") +public func _bjs_RetainLeakSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension RetainLeakSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_RetainLeakSubject_wrap") +fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_RetainLeakSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_RetainLeakSubject_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_ArrayIdentityElement_init") +@_cdecl("bjs_ArrayIdentityElement_init") +public func _bjs_ArrayIdentityElement_init(_ tag: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ArrayIdentityElement(tag: Int.bridgeJSLiftParameter(tag)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayIdentityElement_tag_get") +@_cdecl("bjs_ArrayIdentityElement_tag_get") +public func _bjs_ArrayIdentityElement_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = ArrayIdentityElement.bridgeJSLiftParameter(_self).tag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayIdentityElement_tag_set") +@_cdecl("bjs_ArrayIdentityElement_tag_set") +public func _bjs_ArrayIdentityElement_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + ArrayIdentityElement.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ArrayIdentityElement_deinit") +@_cdecl("bjs_ArrayIdentityElement_deinit") +public func _bjs_ArrayIdentityElement_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension ArrayIdentityElement: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayIdentityElement_wrap") +fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_ArrayIdentityElement_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ArrayIdentityElement_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_OptionalHolder_init") +@_cdecl("bjs_OptionalHolder_init") +public func _bjs_OptionalHolder_init(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = OptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalHolder_nullableGreeter_get") +@_cdecl("bjs_OptionalHolder_nullableGreeter_get") +public func _bjs_OptionalHolder_nullableGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalHolder_nullableGreeter_set") +@_cdecl("bjs_OptionalHolder_nullableGreeter_set") +public func _bjs_OptionalHolder_nullableGreeter_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalHolder_undefinedNumber_get") +@_cdecl("bjs_OptionalHolder_undefinedNumber_get") +public func _bjs_OptionalHolder_undefinedNumber_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalHolder_undefinedNumber_set") +@_cdecl("bjs_OptionalHolder_undefinedNumber_set") +public func _bjs_OptionalHolder_undefinedNumber_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { + #if arch(wasm32) + OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber = JSUndefinedOr.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalHolder_deinit") +@_cdecl("bjs_OptionalHolder_deinit") +public func _bjs_OptionalHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension OptionalHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_OptionalHolder_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalHolder_wrap") +fileprivate func _bjs_OptionalHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_OptionalHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_OptionalHolder_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_OptionalPropertyHolder_init") +@_cdecl("bjs_OptionalPropertyHolder_init") +public func _bjs_OptionalPropertyHolder_init(_ optionalNameIsSome: Int32, _ optionalNameBytes: Int32, _ optionalNameLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = OptionalPropertyHolder(optionalName: Optional.bridgeJSLiftParameter(optionalNameIsSome, optionalNameBytes, optionalNameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_get") +@_cdecl("bjs_OptionalPropertyHolder_optionalName_get") +public func _bjs_OptionalPropertyHolder_optionalName_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_set") +@_cdecl("bjs_OptionalPropertyHolder_optionalName_set") +public func _bjs_OptionalPropertyHolder_optionalName_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_get") +@_cdecl("bjs_OptionalPropertyHolder_optionalAge_get") +public func _bjs_OptionalPropertyHolder_optionalAge_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_set") +@_cdecl("bjs_OptionalPropertyHolder_optionalAge_set") +public func _bjs_OptionalPropertyHolder_optionalAge_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { + #if arch(wasm32) + OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_get") +@_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_get") +public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_set") +@_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_set") +public func _bjs_OptionalPropertyHolder_optionalGreeter_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_OptionalPropertyHolder_deinit") +@_cdecl("bjs_OptionalPropertyHolder_deinit") +public func _bjs_OptionalPropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") +fileprivate func _bjs_OptionalPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_OptionalPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_OptionalPropertyHolder_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_Container_init") +@_cdecl("bjs_Container_init") +public func _bjs_Container_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let _tmp_config = Optional.bridgeJSLiftParameter() + let _tmp_location = DataPoint.bridgeJSLiftParameter() + let ret = Container(location: _tmp_location, config: _tmp_config) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Container_location_get") +@_cdecl("bjs_Container_location_get") +public func _bjs_Container_location_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = Container.bridgeJSLiftParameter(_self).location + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Container_location_set") +@_cdecl("bjs_Container_location_set") +public func _bjs_Container_location_set(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Container.bridgeJSLiftParameter(_self).location = DataPoint.bridgeJSLiftParameter() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Container_config_get") +@_cdecl("bjs_Container_config_get") +public func _bjs_Container_config_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = Container.bridgeJSLiftParameter(_self).config + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Container_config_set") +@_cdecl("bjs_Container_config_set") +public func _bjs_Container_config_set(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Container.bridgeJSLiftParameter(_self).config = Optional.bridgeJSLiftParameter() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_Container_deinit") +@_cdecl("bjs_Container_deinit") +public func _bjs_Container_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension Container: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_Container_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_Container_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Container_wrap") +fileprivate func _bjs_Container_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_Container_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_Container_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_LeakCheck_init") +@_cdecl("bjs_LeakCheck_init") +public func _bjs_LeakCheck_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = LeakCheck() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_LeakCheck_deinit") +@_cdecl("bjs_LeakCheck_deinit") +public func _bjs_LeakCheck_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension LeakCheck: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + public var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_LeakCheck_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + public consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_LeakCheck_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_LeakCheck_wrap") +fileprivate func _bjs_LeakCheck_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_LeakCheck_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_LeakCheck_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_LeakCheck_wrap_extern(pointer) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayElementObject_init") +fileprivate func bjs_ArrayElementObject_init_extern(_ idBytes: Int32, _ idLength: Int32) -> Int32 +#else +fileprivate func bjs_ArrayElementObject_init_extern(_ idBytes: Int32, _ idLength: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArrayElementObject_init(_ idBytes: Int32, _ idLength: Int32) -> Int32 { + return bjs_ArrayElementObject_init_extern(idBytes, idLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayElementObject_id_get") +fileprivate func bjs_ArrayElementObject_id_get_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_ArrayElementObject_id_get_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArrayElementObject_id_get(_ self: Int32) -> Int32 { + return bjs_ArrayElementObject_id_get_extern(self) +} + +func _$ArrayElementObject_init(_ id: String) throws(JSException) -> JSObject { + let ret0 = id.bridgeJSWithLoweredParameter { (idBytes, idLength) in + let ret = bjs_ArrayElementObject_init(idBytes, idLength) + return ret + } + let ret = ret0 + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$ArrayElementObject_id_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_ArrayElementObject_id_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsIntArrayLength_static") +fileprivate func bjs_ArraySupportImports_jsIntArrayLength_static_extern() -> Int32 +#else +fileprivate func bjs_ArraySupportImports_jsIntArrayLength_static_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsIntArrayLength_static() -> Int32 { + return bjs_ArraySupportImports_jsIntArrayLength_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripIntArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripIntArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripIntArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripIntArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripIntArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripNumberArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripNumberArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripNumberArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripNumberArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripNumberArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripStringArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripStringArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripStringArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripStringArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripStringArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripBoolArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripBoolArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripBoolArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripBoolArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripBoolArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripJSValueArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripJSValueArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripJSValueArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripJSValueArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripJSValueArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripJSObjectArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripJSObjectArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripJSObjectArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripJSObjectArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripJSObjectArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripJSClassArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripJSClassArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripJSClassArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripJSClassArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripJSClassArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static") +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static() -> Void { + return bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsSumNumberArray_static") +fileprivate func bjs_ArraySupportImports_jsSumNumberArray_static_extern() -> Float64 +#else +fileprivate func bjs_ArraySupportImports_jsSumNumberArray_static_extern() -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsSumNumberArray_static() -> Float64 { + return bjs_ArraySupportImports_jsSumNumberArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsCreateNumberArray_static") +fileprivate func bjs_ArraySupportImports_jsCreateNumberArray_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_jsCreateNumberArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_jsCreateNumberArray_static() -> Void { + return bjs_ArraySupportImports_jsCreateNumberArray_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_runJsArraySupportTests_static") +fileprivate func bjs_ArraySupportImports_runJsArraySupportTests_static_extern() -> Void +#else +fileprivate func bjs_ArraySupportImports_runJsArraySupportTests_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ArraySupportImports_runJsArraySupportTests_static() -> Void { + return bjs_ArraySupportImports_runJsArraySupportTests_static_extern() +} + +func _$ArraySupportImports_jsIntArrayLength(_ items: [Int]) throws(JSException) -> Int { + let _ = items.bridgeJSLowerParameter() + let ret = bjs_ArraySupportImports_jsIntArrayLength_static() + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +func _$ArraySupportImports_jsRoundTripIntArray(_ items: [Int]) throws(JSException) -> [Int] { + let _ = items.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripIntArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Int].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripNumberArray(_ values: [Double]) throws(JSException) -> [Double] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripNumberArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Double].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripStringArray(_ values: [String]) throws(JSException) -> [String] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripStringArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [String].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripBoolArray(_ values: [Bool]) throws(JSException) -> [Bool] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripBoolArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Bool].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripJSValueArray(_ v: [JSValue]) throws(JSException) -> [JSValue] { + let _ = v.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripJSValueArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [JSValue].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripJSObjectArray(_ values: [JSObject]) throws(JSException) -> [JSObject] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripJSObjectArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [JSObject].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripJSClassArray(_ values: [ArrayElementObject]) throws(JSException) -> [ArrayElementObject] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripJSClassArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [ArrayElementObject].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripOptionalIntArray(_ values: [Optional]) throws(JSException) -> [Optional] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Optional].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripOptionalStringArray(_ values: [Optional]) throws(JSException) -> [Optional] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Optional].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripOptionalBoolArray(_ values: [Optional]) throws(JSException) -> [Optional] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Optional].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripOptionalJSValueArray(_ values: [Optional]) throws(JSException) -> [Optional] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Optional].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripOptionalJSObjectArray(_ values: [Optional]) throws(JSException) -> [Optional] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Optional].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsRoundTripOptionalJSClassArray(_ values: [Optional]) throws(JSException) -> [Optional] { + let _ = values.bridgeJSLowerParameter() + bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Optional].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_jsSumNumberArray(_ values: [Double]) throws(JSException) -> Double { + let _ = values.bridgeJSLowerParameter() + let ret = bjs_ArraySupportImports_jsSumNumberArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +func _$ArraySupportImports_jsCreateNumberArray() throws(JSException) -> [Double] { + bjs_ArraySupportImports_jsCreateNumberArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [Double].bridgeJSLiftReturn() +} + +func _$ArraySupportImports_runJsArraySupportTests() throws(JSException) -> Void { + bjs_ArraySupportImports_runJsArraySupportTests_static() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripVoid_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripVoid_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripVoid_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripVoid_static(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripVoid_static_extern(resolveRef, rejectRef) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripNumber_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripNumber_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Float64) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripNumber_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripNumber_static(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Float64) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripNumber_static_extern(resolveRef, rejectRef, v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripBool_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBool_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Int32) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBool_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBool_static(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Int32) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripBool_static_extern(resolveRef, rejectRef, v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripString_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripString_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripString_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripString_static(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripString_static_extern(resolveRef, rejectRef, vBytes, vLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static_extern(resolveRef, rejectRef, vIsSome, vBytes, vLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vValue: Float64) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vValue: Float64) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static_extern(resolveRef, rejectRef, vIsSome, vValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static_extern(resolveRef, rejectRef) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static_extern(resolveRef, rejectRef) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static_extern(resolveRef, rejectRef) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static") +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void +#else +fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { + return bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static_extern(resolveRef, rejectRef, vBytes, vLength) +} + +func _$AsyncImportImports_jsAsyncRoundTripVoid() async throws(JSException) -> Void { + try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<() -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + bjs_AsyncImportImports_jsAsyncRoundTripVoid_static(resolveRef, rejectRef) + } +} + +func _$AsyncImportImports_jsAsyncRoundTripNumber(_ v: Double) async throws(JSException) -> Double { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending Double) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + let vValue = v.bridgeJSLowerParameter() + bjs_AsyncImportImports_jsAsyncRoundTripNumber_static(resolveRef, rejectRef, vValue) + } + return resolved +} + +func _$AsyncImportImports_jsAsyncRoundTripBool(_ v: Bool) async throws(JSException) -> Bool { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending Bool) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + let vValue = v.bridgeJSLowerParameter() + bjs_AsyncImportImports_jsAsyncRoundTripBool_static(resolveRef, rejectRef, vValue) + } + return resolved +} + +func _$AsyncImportImports_jsAsyncRoundTripString(_ v: String) async throws(JSException) -> String { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending String) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + v.bridgeJSWithLoweredParameter { (vBytes, vLength) in + bjs_AsyncImportImports_jsAsyncRoundTripString_static(resolveRef, rejectRef, vBytes, vLength) + } + } + return resolved +} + +func _$AsyncImportImports_jsAsyncRoundTripOptionalString(_ v: Optional) async throws(JSException) -> Optional { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending Optional) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + v.bridgeJSWithLoweredParameter { (vIsSome, vBytes, vLength) in + bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static(resolveRef, rejectRef, vIsSome, vBytes, vLength) + } + } + return resolved +} + +func _$AsyncImportImports_jsAsyncRoundTripOptionalNumber(_ v: Optional) async throws(JSException) -> Optional { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending Optional) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + let (vIsSome, vValue) = v.bridgeJSLowerParameter() + bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static(resolveRef, rejectRef, vIsSome, vValue) + } + return resolved +} + +func _$AsyncImportImports_jsAsyncRoundTripBoolArray(_ values: [Bool]) async throws(JSException) -> [Bool] { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending [Bool]) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + let _ = values.bridgeJSLowerParameter() + bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static(resolveRef, rejectRef) + } + return resolved +} + +func _$AsyncImportImports_jsAsyncRoundTripIntArray(_ values: [Double]) async throws(JSException) -> [Double] { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending [Double]) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + let _ = values.bridgeJSLowerParameter() + bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static(resolveRef, rejectRef) + } + return resolved +} + +func _$AsyncImportImports_jsAsyncRoundTripStringArray(_ values: [String]) async throws(JSException) -> [String] { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending [String]) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + let _ = values.bridgeJSLowerParameter() + bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static(resolveRef, rejectRef) + } + return resolved +} + +func _$AsyncImportImports_jsAsyncRoundTripFeatureFlag(_ v: FeatureFlag) async throws(JSException) -> FeatureFlag { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending FeatureFlag) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + v.bridgeJSWithLoweredParameter { (vBytes, vLength) in + bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static(resolveRef, rejectRef, vBytes, vLength) + } + } + return resolved +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyVoid_static") +fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static_extern(_ callback: Int32) -> Void +#else +fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static_extern(_ callback: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static(_ callback: Int32) -> Void { + return bjs_ClosureSupportImports_jsApplyVoid_static_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyBool_static") +fileprivate func bjs_ClosureSupportImports_jsApplyBool_static_extern(_ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyBool_static_extern(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyBool_static(_ callback: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsApplyBool_static_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyInt_static") +fileprivate func bjs_ClosureSupportImports_jsApplyInt_static_extern(_ value: Int32, _ transform: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyInt_static_extern(_ value: Int32, _ transform: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyInt_static(_ value: Int32, _ transform: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsApplyInt_static_extern(value, transform) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyDouble_static") +fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static_extern(_ value: Float64, _ transform: Int32) -> Float64 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static_extern(_ value: Float64, _ transform: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static(_ value: Float64, _ transform: Int32) -> Float64 { + return bjs_ClosureSupportImports_jsApplyDouble_static_extern(value, transform) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyString_static") +fileprivate func bjs_ClosureSupportImports_jsApplyString_static_extern(_ valueBytes: Int32, _ valueLength: Int32, _ transform: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyString_static_extern(_ valueBytes: Int32, _ valueLength: Int32, _ transform: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyString_static(_ valueBytes: Int32, _ valueLength: Int32, _ transform: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsApplyString_static_extern(valueBytes, valueLength, transform) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyJSObject_static") +fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static_extern(_ value: Int32, _ transform: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static_extern(_ value: Int32, _ transform: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static(_ value: Int32, _ transform: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsApplyJSObject_static_extern(value, transform) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsMakeIntToInt_static") +fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static_extern(_ base: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static_extern(_ base: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static(_ base: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsMakeIntToInt_static_extern(base) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsMakeDoubleToDouble_static") +fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static_extern(_ base: Float64) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static_extern(_ base: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static(_ base: Float64) -> Int32 { + return bjs_ClosureSupportImports_jsMakeDoubleToDouble_static_extern(base) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsMakeStringToString_static") +fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static_extern(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static_extern(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsMakeStringToString_static_extern(prefixBytes, prefixLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallTwice_static") +fileprivate func bjs_ClosureSupportImports_jsCallTwice_static_extern(_ value: Int32, _ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsCallTwice_static_extern(_ value: Int32, _ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallTwice_static(_ value: Int32, _ callback: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsCallTwice_static_extern(value, callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallBinary_static") +fileprivate func bjs_ClosureSupportImports_jsCallBinary_static_extern(_ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsCallBinary_static_extern(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallBinary_static(_ callback: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsCallBinary_static_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallTriple_static") +fileprivate func bjs_ClosureSupportImports_jsCallTriple_static_extern(_ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsCallTriple_static_extern(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallTriple_static(_ callback: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsCallTriple_static_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallAfterRelease_static") +fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static_extern(_ callback: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static_extern(_ callback: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static(_ callback: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsCallAfterRelease_static_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsOptionalInvoke_static") +fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static_extern(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static_extern(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 { + return bjs_ClosureSupportImports_jsOptionalInvoke_static_extern(callbackIsSome, callbackFuncRef) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsStoreClosure_static") +fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static_extern(_ callback: Int32) -> Void +#else +fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static_extern(_ callback: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static(_ callback: Int32) -> Void { + return bjs_ClosureSupportImports_jsStoreClosure_static_extern(callback) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallStoredClosure_static") +fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static_extern() -> Void +#else +fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static() -> Void { + return bjs_ClosureSupportImports_jsCallStoredClosure_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsHeapCount_static") +fileprivate func bjs_ClosureSupportImports_jsHeapCount_static_extern() -> Int32 +#else +fileprivate func bjs_ClosureSupportImports_jsHeapCount_static_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_jsHeapCount_static() -> Int32 { + return bjs_ClosureSupportImports_jsHeapCount_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_runJsClosureSupportTests_static") +fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static_extern() -> Void +#else +fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static() -> Void { + return bjs_ClosureSupportImports_runJsClosureSupportTests_static_extern() +} + +func _$ClosureSupportImports_jsApplyVoid(_ callback: JSTypedClosure<() -> Void>) throws(JSException) -> Void { + let callbackFuncRef = callback.bridgeJSLowerParameter() + bjs_ClosureSupportImports_jsApplyVoid_static(callbackFuncRef) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$ClosureSupportImports_jsApplyBool(_ callback: JSTypedClosure<() -> Bool>) throws(JSException) -> Bool { + let callbackFuncRef = callback.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsApplyBool_static(callbackFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsApplyInt(_ value: Int, _ transform: JSTypedClosure<(Int) -> Int>) throws(JSException) -> Int { + let valueValue = value.bridgeJSLowerParameter() + let transformFuncRef = transform.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsApplyInt_static(valueValue, transformFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsApplyDouble(_ value: Double, _ transform: JSTypedClosure<(Double) -> Double>) throws(JSException) -> Double { + let valueValue = value.bridgeJSLowerParameter() + let transformFuncRef = transform.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsApplyDouble_static(valueValue, transformFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsApplyString(_ value: String, _ transform: JSTypedClosure<(String) -> String>) throws(JSException) -> String { + let ret0 = value.bridgeJSWithLoweredParameter { (valueBytes, valueLength) in + let transformFuncRef = transform.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsApplyString_static(valueBytes, valueLength, transformFuncRef) + return ret + } + let ret = ret0 + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsApplyJSObject(_ value: JSObject, _ transform: JSTypedClosure<(JSObject) -> JSObject>) throws(JSException) -> JSObject { + let valueValue = value.bridgeJSLowerParameter() + let transformFuncRef = transform.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsApplyJSObject_static(valueValue, transformFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsMakeIntToInt(_ base: Int) throws(JSException) -> (Int) -> Int { + let baseValue = base.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsMakeIntToInt_static(baseValue) + if let error = _swift_js_take_exception() { + throw error + } + return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLift(ret) +} + +func _$ClosureSupportImports_jsMakeDoubleToDouble(_ base: Double) throws(JSException) -> (Double) -> Double { + let baseValue = base.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsMakeDoubleToDouble_static(baseValue) + if let error = _swift_js_take_exception() { + throw error + } + return _BJS_Closure_20BridgeJSRuntimeTestsSd_Sd.bridgeJSLift(ret) +} + +func _$ClosureSupportImports_jsMakeStringToString(_ prefix: String) throws(JSException) -> (String) -> String { + let ret0 = prefix.bridgeJSWithLoweredParameter { (prefixBytes, prefixLength) in + let ret = bjs_ClosureSupportImports_jsMakeStringToString_static(prefixBytes, prefixLength) + return ret + } + let ret = ret0 + if let error = _swift_js_take_exception() { + throw error + } + return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(ret) +} + +func _$ClosureSupportImports_jsCallTwice(_ value: Int, _ callback: JSTypedClosure<(Int) -> Void>) throws(JSException) -> Int { + let valueValue = value.bridgeJSLowerParameter() + let callbackFuncRef = callback.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsCallTwice_static(valueValue, callbackFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsCallBinary(_ callback: JSTypedClosure<(Int, Int) -> Int>) throws(JSException) -> Int { + let callbackFuncRef = callback.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsCallBinary_static(callbackFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsCallTriple(_ callback: JSTypedClosure<(Int, Int, Int) -> Int>) throws(JSException) -> Int { + let callbackFuncRef = callback.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsCallTriple_static(callbackFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsCallAfterRelease(_ callback: JSTypedClosure<() -> Void>) throws(JSException) -> String { + let callbackFuncRef = callback.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsCallAfterRelease_static(callbackFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsOptionalInvoke(_ callback: Optional Bool>>) throws(JSException) -> Bool { + let (callbackIsSome, callbackFuncRef) = callback.bridgeJSLowerParameter() + let ret = bjs_ClosureSupportImports_jsOptionalInvoke_static(callbackIsSome, callbackFuncRef) + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_jsStoreClosure(_ callback: JSTypedClosure<() -> Void>) throws(JSException) -> Void { + let callbackFuncRef = callback.bridgeJSLowerParameter() + bjs_ClosureSupportImports_jsStoreClosure_static(callbackFuncRef) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$ClosureSupportImports_jsCallStoredClosure() throws(JSException) -> Void { + bjs_ClosureSupportImports_jsCallStoredClosure_static() + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$ClosureSupportImports_jsHeapCount() throws(JSException) -> Int { + let ret = bjs_ClosureSupportImports_jsHeapCount_static() + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +func _$ClosureSupportImports_runJsClosureSupportTests() throws(JSException) -> Void { + bjs_ClosureSupportImports_runJsClosureSupportTests_static() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static") +fileprivate func bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static_extern() -> Void +#else +fileprivate func bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static() -> Void { + return bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static_extern() +} + +func _$DefaultArgumentImports_runJsDefaultArgumentTests() throws(JSException) -> Void { + bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static") +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static_extern() -> Void +#else +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static() -> Void { + return bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static") +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static_extern() -> Void +#else +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static() -> Void { + return bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static") +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static_extern() -> Void +#else +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static() -> Void { + return bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static") +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static_extern() -> Void +#else +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static() -> Void { + return bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static") +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static_extern() -> Void +#else +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static() -> Void { + return bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static") +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static_extern() -> Void +#else +fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static() -> Void { + return bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static_extern() +} + +func _$DictionarySupportImports_jsRoundTripDictionaryInt(_ values: [String: Int]) throws(JSException) -> [String: Int] { + let _ = values.bridgeJSLowerParameter() + bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static() + if let error = _swift_js_take_exception() { + throw error + } + return [String: Int].bridgeJSLiftReturn() +} + +func _$DictionarySupportImports_jsRoundTripDictionaryBool(_ values: [String: Bool]) throws(JSException) -> [String: Bool] { + let _ = values.bridgeJSLowerParameter() + bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static() + if let error = _swift_js_take_exception() { + throw error + } + return [String: Bool].bridgeJSLiftReturn() +} + +func _$DictionarySupportImports_jsRoundTripDictionaryDouble(_ values: [String: Double]) throws(JSException) -> [String: Double] { + let _ = values.bridgeJSLowerParameter() + bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static() + if let error = _swift_js_take_exception() { + throw error + } + return [String: Double].bridgeJSLiftReturn() +} + +func _$DictionarySupportImports_jsRoundTripDictionaryJSObject(_ values: [String: JSObject]) throws(JSException) -> [String: JSObject] { + let _ = values.bridgeJSLowerParameter() + bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static() + if let error = _swift_js_take_exception() { + throw error + } + return [String: JSObject].bridgeJSLiftReturn() +} + +func _$DictionarySupportImports_jsRoundTripDictionaryJSValue(_ values: [String: JSValue]) throws(JSException) -> [String: JSValue] { + let _ = values.bridgeJSLowerParameter() + bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static() + if let error = _swift_js_take_exception() { + throw error + } + return [String: JSValue].bridgeJSLiftReturn() +} + +func _$DictionarySupportImports_jsRoundTripDictionaryDoubleArray(_ values: [String: [Double]]) throws(JSException) -> [String: [Double]] { + let _ = values.bridgeJSLowerParameter() + bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static() + if let error = _swift_js_take_exception() { + throw error + } + return [String: [Double]].bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Foo_init") +fileprivate func bjs_Foo_init_extern(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 +#else +fileprivate func bjs_Foo_init_extern(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Foo_init(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { + return bjs_Foo_init_extern(valueBytes, valueLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Foo_value_get") +fileprivate func bjs_Foo_value_get_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Foo_value_get_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Foo_value_get(_ self: Int32) -> Int32 { + return bjs_Foo_value_get_extern(self) +} + +func _$Foo_init(_ value: String) throws(JSException) -> JSObject { + let ret0 = value.bridgeJSWithLoweredParameter { (valueBytes, valueLength) in + let ret = bjs_Foo_init(valueBytes, valueLength) + return ret + } + let ret = ret0 + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$Foo_value_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Foo_value_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_globalObject1_get") +fileprivate func bjs_globalObject1_get_extern() -> Void +#else +fileprivate func bjs_globalObject1_get_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_globalObject1_get() -> Void { + return bjs_globalObject1_get_extern() +} + +func _$globalObject1_get() throws(JSException) -> JSValue { + bjs_globalObject1_get() + if let error = _swift_js_take_exception() { + throw error + } + return JSValue.bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") +fileprivate func bjs_jsRoundTripVoid_extern() -> Void +#else +fileprivate func bjs_jsRoundTripVoid_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsRoundTripVoid() -> Void { + return bjs_jsRoundTripVoid_extern() +} + +func _$jsRoundTripVoid() throws(JSException) -> Void { + bjs_jsRoundTripVoid() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumber") +fileprivate func bjs_jsRoundTripNumber_extern(_ v: Float64) -> Float64 +#else +fileprivate func bjs_jsRoundTripNumber_extern(_ v: Float64) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { + return bjs_jsRoundTripNumber_extern(v) +} + +func _$jsRoundTripNumber(_ v: Double) throws(JSException) -> Double { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_jsRoundTripNumber(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBool") +fileprivate func bjs_jsRoundTripBool_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_jsRoundTripBool_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { + return bjs_jsRoundTripBool_extern(v) +} + +func _$jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_jsRoundTripBool(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripString") +fileprivate func bjs_jsRoundTripString_extern(_ vBytes: Int32, _ vLength: Int32) -> Int32 +#else +fileprivate func bjs_jsRoundTripString_extern(_ vBytes: Int32, _ vLength: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsRoundTripString(_ vBytes: Int32, _ vLength: Int32) -> Int32 { + return bjs_jsRoundTripString_extern(vBytes, vLength) +} + +func _$jsRoundTripString(_ v: String) throws(JSException) -> String { + let ret0 = v.bridgeJSWithLoweredParameter { (vBytes, vLength) in + let ret = bjs_jsRoundTripString(vBytes, vLength) + return ret + } + let ret = ret0 + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripJSValue") +fileprivate func bjs_jsRoundTripJSValue_extern(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void +#else +fileprivate func bjs_jsRoundTripJSValue_extern(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsRoundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { + return bjs_jsRoundTripJSValue_extern(vKind, vPayload1, vPayload2) +} + +func _$jsRoundTripJSValue(_ v: JSValue) throws(JSException) -> JSValue { + let (vKind, vPayload1, vPayload2) = v.bridgeJSLowerParameter() + bjs_jsRoundTripJSValue(vKind, vPayload1, vPayload2) + if let error = _swift_js_take_exception() { + throw error + } + return JSValue.bridgeJSLiftReturn() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") +fileprivate func bjs_jsThrowOrVoid_extern(_ shouldThrow: Int32) -> Void +#else +fileprivate func bjs_jsThrowOrVoid_extern(_ shouldThrow: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { + return bjs_jsThrowOrVoid_extern(shouldThrow) +} + +func _$jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void { + let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() + bjs_jsThrowOrVoid(shouldThrowValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrNumber") +fileprivate func bjs_jsThrowOrNumber_extern(_ shouldThrow: Int32) -> Float64 +#else +fileprivate func bjs_jsThrowOrNumber_extern(_ shouldThrow: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { + return bjs_jsThrowOrNumber_extern(shouldThrow) +} + +func _$jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double { + let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() + let ret = bjs_jsThrowOrNumber(shouldThrowValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrBool") +fileprivate func bjs_jsThrowOrBool_extern(_ shouldThrow: Int32) -> Int32 +#else +fileprivate func bjs_jsThrowOrBool_extern(_ shouldThrow: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { + return bjs_jsThrowOrBool_extern(shouldThrow) +} + +func _$jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool { + let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() + let ret = bjs_jsThrowOrBool(shouldThrowValue) + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrString") +fileprivate func bjs_jsThrowOrString_extern(_ shouldThrow: Int32) -> Int32 +#else +fileprivate func bjs_jsThrowOrString_extern(_ shouldThrow: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { + return bjs_jsThrowOrString_extern(shouldThrow) +} + +func _$jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { + let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() + let ret = bjs_jsThrowOrString(shouldThrowValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripFeatureFlag") +fileprivate func bjs_jsRoundTripFeatureFlag_extern(_ flagBytes: Int32, _ flagLength: Int32) -> Int32 +#else +fileprivate func bjs_jsRoundTripFeatureFlag_extern(_ flagBytes: Int32, _ flagLength: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsRoundTripFeatureFlag(_ flagBytes: Int32, _ flagLength: Int32) -> Int32 { + return bjs_jsRoundTripFeatureFlag_extern(flagBytes, flagLength) +} + +func _$jsRoundTripFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> FeatureFlag { + let ret0 = flag.bridgeJSWithLoweredParameter { (flagBytes, flagLength) in + let ret = bjs_jsRoundTripFeatureFlag(flagBytes, flagLength) + return ret + } + let ret = ret0 + if let error = _swift_js_take_exception() { + throw error + } + return FeatureFlag.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runAsyncWorks") +fileprivate func bjs_runAsyncWorks_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void +#else +fileprivate func bjs_runAsyncWorks_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_runAsyncWorks(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { + return bjs_runAsyncWorks_extern(resolveRef, rejectRef) +} + +func _$runAsyncWorks() async throws(JSException) -> Void { + try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<() -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + bjs_runAsyncWorks(resolveRef, rejectRef) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_fetchWeatherData") +fileprivate func bjs_fetchWeatherData_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ cityBytes: Int32, _ cityLength: Int32) -> Void +#else +fileprivate func bjs_fetchWeatherData_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ cityBytes: Int32, _ cityLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_fetchWeatherData(_ resolveRef: Int32, _ rejectRef: Int32, _ cityBytes: Int32, _ cityLength: Int32) -> Void { + return bjs_fetchWeatherData_extern(resolveRef, rejectRef, cityBytes, cityLength) +} + +func _$fetchWeatherData(_ city: String) async throws(JSException) -> WeatherData { + let resolved = try await _bjs_awaitPromise(makeResolveClosure: { + JSTypedClosure<(sending WeatherData) -> Void>($0) + }, makeRejectClosure: { + JSTypedClosure<(sending JSValue) -> Void>($0) + }) { resolveRef, rejectRef in + city.bridgeJSWithLoweredParameter { (cityBytes, cityLength) in + bjs_fetchWeatherData(resolveRef, rejectRef, cityBytes, cityLength) + } + } + return resolved +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__jsWeirdFunction") +fileprivate func bjs__jsWeirdFunction_extern() -> Float64 +#else +fileprivate func bjs__jsWeirdFunction_extern() -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs__jsWeirdFunction() -> Float64 { + return bjs__jsWeirdFunction_extern() +} + +func _$_jsWeirdFunction() throws(JSException) -> Double { + let ret = bjs__jsWeirdFunction() + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_parseInt") +fileprivate func bjs_parseInt_extern(_ stringBytes: Int32, _ stringLength: Int32) -> Float64 +#else +fileprivate func bjs_parseInt_extern(_ stringBytes: Int32, _ stringLength: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_parseInt(_ stringBytes: Int32, _ stringLength: Int32) -> Float64 { + return bjs_parseInt_extern(stringBytes, stringLength) +} + +func _$parseInt(_ string: String) throws(JSException) -> Double { + let ret0 = string.bridgeJSWithLoweredParameter { (stringBytes, stringLength) in + let ret = bjs_parseInt(stringBytes, stringLength) + return ret + } + let ret = ret0 + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") +fileprivate func bjs_JsGreeter_init_extern(_ nameBytes: Int32, _ nameLength: Int32, _ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_init_extern(_ nameBytes: Int32, _ nameLength: Int32, _ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JsGreeter_init(_ nameBytes: Int32, _ nameLength: Int32, _ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { + return bjs_JsGreeter_init_extern(nameBytes, nameLength, prefixBytes, prefixLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") +fileprivate func bjs_JsGreeter_name_get_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_name_get_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { + return bjs_JsGreeter_name_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_prefix_get") +fileprivate func bjs_JsGreeter_prefix_get_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_prefix_get_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { + return bjs_JsGreeter_prefix_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_set") +fileprivate func bjs_JsGreeter_name_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void +#else +fileprivate func bjs_JsGreeter_name_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + return bjs_JsGreeter_name_set_extern(self, newValueBytes, newValueLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") +fileprivate func bjs_JsGreeter_greet_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_greet_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { + return bjs_JsGreeter_greet_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_changeName") +fileprivate func bjs_JsGreeter_changeName_extern(_ self: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void +#else +fileprivate func bjs_JsGreeter_changeName_extern(_ self: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + return bjs_JsGreeter_changeName_extern(self, nameBytes, nameLength) +} + +func _$JsGreeter_init(_ name: String, _ prefix: String) throws(JSException) -> JSObject { + let ret0 = name.bridgeJSWithLoweredParameter { (nameBytes, nameLength) in + let ret1 = prefix.bridgeJSWithLoweredParameter { (prefixBytes, prefixLength) in + let ret = bjs_JsGreeter_init(nameBytes, nameLength, prefixBytes, prefixLength) + return ret + } + return ret1 + } + let ret = ret0 + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$JsGreeter_name_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_JsGreeter_name_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$JsGreeter_prefix_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_JsGreeter_prefix_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$JsGreeter_name_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + newValue.bridgeJSWithLoweredParameter { (newValueBytes, newValueLength) in + bjs_JsGreeter_name_set(selfValue, newValueBytes, newValueLength) + } + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$JsGreeter_greet(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_JsGreeter_greet(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$JsGreeter_changeName(_ self: JSObject, _ name: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + name.bridgeJSWithLoweredParameter { (nameBytes, nameLength) in + bjs_JsGreeter_changeName(selfValue, nameBytes, nameLength) + } + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_temperature_get") +fileprivate func bjs_WeatherData_temperature_get_extern(_ self: Int32) -> Float64 +#else +fileprivate func bjs_WeatherData_temperature_get_extern(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_WeatherData_temperature_get(_ self: Int32) -> Float64 { + return bjs_WeatherData_temperature_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_description_get") +fileprivate func bjs_WeatherData_description_get_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_WeatherData_description_get_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_WeatherData_description_get(_ self: Int32) -> Int32 { + return bjs_WeatherData_description_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_humidity_get") +fileprivate func bjs_WeatherData_humidity_get_extern(_ self: Int32) -> Float64 +#else +fileprivate func bjs_WeatherData_humidity_get_extern(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_WeatherData_humidity_get(_ self: Int32) -> Float64 { + return bjs_WeatherData_humidity_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_temperature_set") +fileprivate func bjs_WeatherData_temperature_set_extern(_ self: Int32, _ newValue: Float64) -> Void +#else +fileprivate func bjs_WeatherData_temperature_set_extern(_ self: Int32, _ newValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_WeatherData_temperature_set(_ self: Int32, _ newValue: Float64) -> Void { + return bjs_WeatherData_temperature_set_extern(self, newValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_description_set") +fileprivate func bjs_WeatherData_description_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void +#else +fileprivate func bjs_WeatherData_description_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_WeatherData_description_set(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + return bjs_WeatherData_description_set_extern(self, newValueBytes, newValueLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_humidity_set") +fileprivate func bjs_WeatherData_humidity_set_extern(_ self: Int32, _ newValue: Float64) -> Void +#else +fileprivate func bjs_WeatherData_humidity_set_extern(_ self: Int32, _ newValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_WeatherData_humidity_set(_ self: Int32, _ newValue: Float64) -> Void { + return bjs_WeatherData_humidity_set_extern(self, newValue) +} + +func _$WeatherData_temperature_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeatherData_temperature_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +func _$WeatherData_description_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeatherData_description_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$WeatherData_humidity_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeatherData_humidity_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +func _$WeatherData_temperature_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeatherData_temperature_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WeatherData_description_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + newValue.bridgeJSWithLoweredParameter { (newValueBytes, newValueLength) in + bjs_WeatherData_description_set(selfValue, newValueBytes, newValueLength) + } + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$WeatherData_humidity_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeatherData_humidity_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__WeirdClass_init") +fileprivate func bjs__WeirdClass_init_extern() -> Int32 +#else +fileprivate func bjs__WeirdClass_init_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs__WeirdClass_init() -> Int32 { + return bjs__WeirdClass_init_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__WeirdClass_method_with_dashes") +fileprivate func bjs__WeirdClass_method_with_dashes_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs__WeirdClass_method_with_dashes_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs__WeirdClass_method_with_dashes(_ self: Int32) -> Int32 { + return bjs__WeirdClass_method_with_dashes_extern(self) +} + +func _$_WeirdClass_init() throws(JSException) -> JSObject { + let ret = bjs__WeirdClass_init() + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$_WeirdClass_method_with_dashes(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs__WeirdClass_method_with_dashes(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_init") +fileprivate func bjs_StaticBox_init_extern(_ value: Float64) -> Int32 +#else +fileprivate func bjs_StaticBox_init_extern(_ value: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_StaticBox_init(_ value: Float64) -> Int32 { + return bjs_StaticBox_init_extern(value) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_create_static") +fileprivate func bjs_StaticBox_create_static_extern(_ value: Float64) -> Int32 +#else +fileprivate func bjs_StaticBox_create_static_extern(_ value: Float64) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { + return bjs_StaticBox_create_static_extern(value) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_value_static") +fileprivate func bjs_StaticBox_value_static_extern() -> Float64 +#else +fileprivate func bjs_StaticBox_value_static_extern() -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_StaticBox_value_static() -> Float64 { + return bjs_StaticBox_value_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_makeDefault_static") +fileprivate func bjs_StaticBox_makeDefault_static_extern() -> Int32 +#else +fileprivate func bjs_StaticBox_makeDefault_static_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { + return bjs_StaticBox_makeDefault_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_with_dashes_static") +fileprivate func bjs_StaticBox_with_dashes_static_extern() -> Int32 +#else +fileprivate func bjs_StaticBox_with_dashes_static_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_StaticBox_with_dashes_static() -> Int32 { + return bjs_StaticBox_with_dashes_static_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_value") +fileprivate func bjs_StaticBox_value_extern(_ self: Int32) -> Float64 +#else +fileprivate func bjs_StaticBox_value_extern(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_StaticBox_value(_ self: Int32) -> Float64 { + return bjs_StaticBox_value_extern(self) +} + +func _$StaticBox_init(_ value: Double) throws(JSException) -> JSObject { + let valueValue = value.bridgeJSLowerParameter() + let ret = bjs_StaticBox_init(valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$StaticBox_create(_ value: Double) throws(JSException) -> StaticBox { + let valueValue = value.bridgeJSLowerParameter() + let ret = bjs_StaticBox_create_static(valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return StaticBox.bridgeJSLiftReturn(ret) +} + +func _$StaticBox_value() throws(JSException) -> Double { + let ret = bjs_StaticBox_value_static() + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +func _$StaticBox_makeDefault() throws(JSException) -> StaticBox { + let ret = bjs_StaticBox_makeDefault_static() + if let error = _swift_js_take_exception() { + throw error + } + return StaticBox.bridgeJSLiftReturn(ret) +} + +func _$StaticBox_with_dashes() throws(JSException) -> StaticBox { + let ret = bjs_StaticBox_with_dashes_static() + if let error = _swift_js_take_exception() { + throw error + } + return StaticBox.bridgeJSLiftReturn(ret) +} + +func _$StaticBox_value(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_StaticBox_value(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_init") +fileprivate func bjs_Animal_init_extern(_ nameBytes: Int32, _ nameLength: Int32, _ age: Float64, _ isCat: Int32) -> Int32 +#else +fileprivate func bjs_Animal_init_extern(_ nameBytes: Int32, _ nameLength: Int32, _ age: Float64, _ isCat: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Animal_init(_ nameBytes: Int32, _ nameLength: Int32, _ age: Float64, _ isCat: Int32) -> Int32 { + return bjs_Animal_init_extern(nameBytes, nameLength, age, isCat) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_name_get") +fileprivate func bjs_Animal_name_get_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Animal_name_get_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Animal_name_get(_ self: Int32) -> Int32 { + return bjs_Animal_name_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_age_get") +fileprivate func bjs_Animal_age_get_extern(_ self: Int32) -> Float64 +#else +fileprivate func bjs_Animal_age_get_extern(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Animal_age_get(_ self: Int32) -> Float64 { + return bjs_Animal_age_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_isCat_get") +fileprivate func bjs_Animal_isCat_get_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Animal_isCat_get_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Animal_isCat_get(_ self: Int32) -> Int32 { + return bjs_Animal_isCat_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_name_set") +fileprivate func bjs_Animal_name_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void +#else +fileprivate func bjs_Animal_name_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Animal_name_set(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { + return bjs_Animal_name_set_extern(self, newValueBytes, newValueLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_age_set") +fileprivate func bjs_Animal_age_set_extern(_ self: Int32, _ newValue: Float64) -> Void +#else +fileprivate func bjs_Animal_age_set_extern(_ self: Int32, _ newValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Animal_age_set(_ self: Int32, _ newValue: Float64) -> Void { + return bjs_Animal_age_set_extern(self, newValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_isCat_set") +fileprivate func bjs_Animal_isCat_set_extern(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_Animal_isCat_set_extern(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Animal_isCat_set(_ self: Int32, _ newValue: Int32) -> Void { + return bjs_Animal_isCat_set_extern(self, newValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_bark") +fileprivate func bjs_Animal_bark_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Animal_bark_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Animal_bark(_ self: Int32) -> Int32 { + return bjs_Animal_bark_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_getIsCat") +fileprivate func bjs_Animal_getIsCat_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_Animal_getIsCat_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_Animal_getIsCat(_ self: Int32) -> Int32 { + return bjs_Animal_getIsCat_extern(self) +} + +func _$Animal_init(_ name: String, _ age: Double, _ isCat: Bool) throws(JSException) -> JSObject { + let ret0 = name.bridgeJSWithLoweredParameter { (nameBytes, nameLength) in + let ageValue = age.bridgeJSLowerParameter() + let isCatValue = isCat.bridgeJSLowerParameter() + let ret = bjs_Animal_init(nameBytes, nameLength, ageValue, isCatValue) + return ret + } + let ret = ret0 + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$Animal_name_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Animal_name_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$Animal_age_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Animal_age_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +func _$Animal_isCat_get(_ self: JSObject) throws(JSException) -> Bool { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Animal_isCat_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) +} + +func _$Animal_name_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + newValue.bridgeJSWithLoweredParameter { (newValueBytes, newValueLength) in + bjs_Animal_name_set(selfValue, newValueBytes, newValueLength) + } + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$Animal_age_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_Animal_age_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$Animal_isCat_set(_ self: JSObject, _ newValue: Bool) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_Animal_isCat_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$Animal_bark(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Animal_bark(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$Animal_getIsCat(_ self: JSObject) throws(JSException) -> Bool { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Animal_getIsCat(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static") +fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -> Void +#else +fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static() -> Void { + return bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() +} + +func _$IdentityModeSupportImports_runJsIdentityModeSupportTests() throws(JSException) -> Void { + bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsTranslatePoint") +fileprivate func bjs_jsTranslatePoint_extern(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 +#else +fileprivate func bjs_jsTranslatePoint_extern(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsTranslatePoint(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { + return bjs_jsTranslatePoint_extern(point, dx, dy) +} + +func _$jsTranslatePoint(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException) -> Point { + let pointObjectId = point.bridgeJSLowerParameter() + let dxValue = dx.bridgeJSLowerParameter() + let dyValue = dy.bridgeJSLowerParameter() + let ret = bjs_jsTranslatePoint(pointObjectId, dxValue, dyValue) + if let error = _swift_js_take_exception() { + throw error + } + return Point.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt8_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt8_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt8_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt8_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt8_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt16_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt16_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt16_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt16_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt16_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt32_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt32_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt32_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt32_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt32_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static_extern(_ v: Int32) -> Int32 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static_extern(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static(_ v: Int32) -> Int32 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt64_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt64_static_extern(_ v: Int64) -> Int64 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt64_static_extern(_ v: Int64) -> Int64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt64_static(_ v: Int64) -> Int64 { + return bjs_IntegerTypesSupportImports_jsRoundTripInt64_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static") +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static_extern(_ v: Int64) -> Int64 +#else +fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static_extern(_ v: Int64) -> Int64 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static(_ v: Int64) -> Int64 { + return bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static") +fileprivate func bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static_extern() -> Void +#else +fileprivate func bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static() -> Void { + return bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static_extern() +} + +func _$IntegerTypesSupportImports_jsRoundTripInt(_ v: Int) throws(JSException) -> Int { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt(_ v: UInt) throws(JSException) -> UInt { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripInt8(_ v: Int8) throws(JSException) -> Int8 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt8_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int8.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt8(_ v: UInt8) throws(JSException) -> UInt8 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt8.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripInt16(_ v: Int16) throws(JSException) -> Int16 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt16_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int16.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt16(_ v: UInt16) throws(JSException) -> UInt16 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt16.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripInt32(_ v: Int32) throws(JSException) -> Int32 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt32_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int32.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt32(_ v: UInt32) throws(JSException) -> UInt32 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt32.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripInt64(_ v: Int64) throws(JSException) -> Int64 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt64_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Int64.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_jsRoundTripUInt64(_ v: UInt64) throws(JSException) -> UInt64 { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return UInt64.bridgeJSLiftReturn(ret) +} + +func _$IntegerTypesSupportImports_runJsIntegerTypesSupportTests() throws(JSException) -> Void { + bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_init") +fileprivate func bjs_JSClassWithArrayMembers_init_extern() -> Int32 +#else +fileprivate func bjs_JSClassWithArrayMembers_init_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JSClassWithArrayMembers_init() -> Int32 { + return bjs_JSClassWithArrayMembers_init_extern() +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_numbers_get") +fileprivate func bjs_JSClassWithArrayMembers_numbers_get_extern(_ self: Int32) -> Void +#else +fileprivate func bjs_JSClassWithArrayMembers_numbers_get_extern(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JSClassWithArrayMembers_numbers_get(_ self: Int32) -> Void { + return bjs_JSClassWithArrayMembers_numbers_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_labels_get") +fileprivate func bjs_JSClassWithArrayMembers_labels_get_extern(_ self: Int32) -> Void +#else +fileprivate func bjs_JSClassWithArrayMembers_labels_get_extern(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JSClassWithArrayMembers_labels_get(_ self: Int32) -> Void { + return bjs_JSClassWithArrayMembers_labels_get_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_numbers_set") +fileprivate func bjs_JSClassWithArrayMembers_numbers_set_extern(_ self: Int32) -> Void +#else +fileprivate func bjs_JSClassWithArrayMembers_numbers_set_extern(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JSClassWithArrayMembers_numbers_set(_ self: Int32) -> Void { + return bjs_JSClassWithArrayMembers_numbers_set_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_labels_set") +fileprivate func bjs_JSClassWithArrayMembers_labels_set_extern(_ self: Int32) -> Void +#else +fileprivate func bjs_JSClassWithArrayMembers_labels_set_extern(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JSClassWithArrayMembers_labels_set(_ self: Int32) -> Void { + return bjs_JSClassWithArrayMembers_labels_set_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_concatNumbers") +fileprivate func bjs_JSClassWithArrayMembers_concatNumbers_extern(_ self: Int32) -> Void +#else +fileprivate func bjs_JSClassWithArrayMembers_concatNumbers_extern(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JSClassWithArrayMembers_concatNumbers(_ self: Int32) -> Void { + return bjs_JSClassWithArrayMembers_concatNumbers_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_concatLabels") +fileprivate func bjs_JSClassWithArrayMembers_concatLabels_extern(_ self: Int32) -> Void +#else +fileprivate func bjs_JSClassWithArrayMembers_concatLabels_extern(_ self: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JSClassWithArrayMembers_concatLabels(_ self: Int32) -> Void { + return bjs_JSClassWithArrayMembers_concatLabels_extern(self) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_firstLabel") +fileprivate func bjs_JSClassWithArrayMembers_firstLabel_extern(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JSClassWithArrayMembers_firstLabel_extern(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JSClassWithArrayMembers_firstLabel(_ self: Int32) -> Int32 { + return bjs_JSClassWithArrayMembers_firstLabel_extern(self) +} + +func _$JSClassWithArrayMembers_init(_ numbers: [Int], _ labels: [String]) throws(JSException) -> JSObject { + let _ = labels.bridgeJSLowerParameter() + let _ = numbers.bridgeJSLowerParameter() + let ret = bjs_JSClassWithArrayMembers_init() + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$JSClassWithArrayMembers_numbers_get(_ self: JSObject) throws(JSException) -> [Int] { + let selfValue = self.bridgeJSLowerParameter() + bjs_JSClassWithArrayMembers_numbers_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return [Int].bridgeJSLiftReturn() +} + +func _$JSClassWithArrayMembers_labels_get(_ self: JSObject) throws(JSException) -> [String] { + let selfValue = self.bridgeJSLowerParameter() + bjs_JSClassWithArrayMembers_labels_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return [String].bridgeJSLiftReturn() +} + +func _$JSClassWithArrayMembers_numbers_set(_ self: JSObject, _ newValue: [Int]) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let _ = newValue.bridgeJSLowerParameter() + bjs_JSClassWithArrayMembers_numbers_set(selfValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$JSClassWithArrayMembers_labels_set(_ self: JSObject, _ newValue: [String]) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let _ = newValue.bridgeJSLowerParameter() + bjs_JSClassWithArrayMembers_labels_set(selfValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$JSClassWithArrayMembers_concatNumbers(_ self: JSObject, _ values: [Int]) throws(JSException) -> [Int] { + let selfValue = self.bridgeJSLowerParameter() + let _ = values.bridgeJSLowerParameter() + bjs_JSClassWithArrayMembers_concatNumbers(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return [Int].bridgeJSLiftReturn() +} + +func _$JSClassWithArrayMembers_concatLabels(_ self: JSObject, _ values: [String]) throws(JSException) -> [String] { + let selfValue = self.bridgeJSLowerParameter() + let _ = values.bridgeJSLowerParameter() + bjs_JSClassWithArrayMembers_concatLabels(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return [String].bridgeJSLiftReturn() +} + +func _$JSClassWithArrayMembers_firstLabel(_ self: JSObject, _ values: [String]) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let _ = values.bridgeJSLowerParameter() + let ret = bjs_JSClassWithArrayMembers_firstLabel(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static") +fileprivate func bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static_extern() -> Int32 +#else +fileprivate func bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static() -> Int32 { + return bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static_extern() +} + +func _$JSClassSupportImports_makeJSClassWithArrayMembers(_ numbers: [Int], _ labels: [String]) throws(JSException) -> JSClassWithArrayMembers { + let _ = labels.bridgeJSLowerParameter() + let _ = numbers.bridgeJSLowerParameter() + let ret = bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static() + if let error = _swift_js_take_exception() { + throw error + } + return JSClassWithArrayMembers.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassInternal_init") +fileprivate func bjs_MyJSClassInternal_init_extern() -> Int32 +#else +fileprivate func bjs_MyJSClassInternal_init_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_MyJSClassInternal_init() -> Int32 { + return bjs_MyJSClassInternal_init_extern() +} + +func _$MyJSClassInternal_init() throws(JSException) -> JSObject { + let ret = bjs_MyJSClassInternal_init() + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassPublic_init") +fileprivate func bjs_MyJSClassPublic_init_extern() -> Int32 +#else +fileprivate func bjs_MyJSClassPublic_init_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_MyJSClassPublic_init() -> Int32 { + return bjs_MyJSClassPublic_init_extern() +} + +func _$MyJSClassPublic_init() throws(JSException) -> JSObject { + let ret = bjs_MyJSClassPublic_init() + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassPackage_init") +fileprivate func bjs_MyJSClassPackage_init_extern() -> Int32 +#else +fileprivate func bjs_MyJSClassPackage_init_extern() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_MyJSClassPackage_init() -> Int32 { + return bjs_MyJSClassPackage_init_extern() +} + +func _$MyJSClassPackage_init() throws(JSException) -> JSObject { + let ret = bjs_MyJSClassPackage_init() + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithPackageAccess") +fileprivate func bjs_jsFunctionWithPackageAccess_extern() -> Void +#else +fileprivate func bjs_jsFunctionWithPackageAccess_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsFunctionWithPackageAccess() -> Void { + return bjs_jsFunctionWithPackageAccess_extern() +} + +func _$jsFunctionWithPackageAccess() throws(JSException) -> Void { + bjs_jsFunctionWithPackageAccess() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithPublicAccess") +fileprivate func bjs_jsFunctionWithPublicAccess_extern() -> Void +#else +fileprivate func bjs_jsFunctionWithPublicAccess_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsFunctionWithPublicAccess() -> Void { + return bjs_jsFunctionWithPublicAccess_extern() +} + +func _$jsFunctionWithPublicAccess() throws(JSException) -> Void { + bjs_jsFunctionWithPublicAccess() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithInternalAccess") +fileprivate func bjs_jsFunctionWithInternalAccess_extern() -> Void +#else +fileprivate func bjs_jsFunctionWithInternalAccess_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsFunctionWithInternalAccess() -> Void { + return bjs_jsFunctionWithInternalAccess_extern() +} + +func _$jsFunctionWithInternalAccess() throws(JSException) -> Void { + bjs_jsFunctionWithInternalAccess() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithFilePrivateAccess") +fileprivate func bjs_jsFunctionWithFilePrivateAccess_extern() -> Void +#else +fileprivate func bjs_jsFunctionWithFilePrivateAccess_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsFunctionWithFilePrivateAccess() -> Void { + return bjs_jsFunctionWithFilePrivateAccess_extern() +} + +func _$jsFunctionWithFilePrivateAccess() throws(JSException) -> Void { + bjs_jsFunctionWithFilePrivateAccess() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithPrivateAccess") +fileprivate func bjs_jsFunctionWithPrivateAccess_extern() -> Void +#else +fileprivate func bjs_jsFunctionWithPrivateAccess_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_jsFunctionWithPrivateAccess() -> Void { + return bjs_jsFunctionWithPrivateAccess_extern() +} + +func _$jsFunctionWithPrivateAccess() throws(JSException) -> Void { + bjs_jsFunctionWithPrivateAccess() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static_extern(valueIsSome, valueValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static_extern(valueIsSome, valueValue) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static_extern(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static_extern(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static_extern(nameIsSome, nameBytes, nameLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static_extern(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static_extern(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static_extern(nameIsSome, nameBytes, nameLength) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static_extern(_ v: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static_extern(_ v: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static(_ v: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static_extern(_ v: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static_extern(_ v: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static(_ v: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static_extern(_ v: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static_extern(_ v: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static(_ v: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static") +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static_extern(_ v: Int32) -> Void +#else +fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static_extern(_ v: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static(_ v: Int32) -> Void { + return bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static_extern(v) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_runJsOptionalSupportTests_static") +fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static_extern() -> Void +#else +fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static() -> Void { + return bjs_OptionalSupportImports_runJsOptionalSupportTests_static_extern() +} + +func _$OptionalSupportImports_jsRoundTripOptionalNumberNull(_ value: Optional) throws(JSException) -> Optional { + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static(valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +func _$OptionalSupportImports_jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() + bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static(valueIsSome, valueValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +func _$OptionalSupportImports_jsRoundTripOptionalStringNull(_ name: Optional) throws(JSException) -> Optional { + name.bridgeJSWithLoweredParameter { (nameIsSome, nameBytes, nameLength) in + bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static(nameIsSome, nameBytes, nameLength) + } + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturnFromSideChannel() +} + +func _$OptionalSupportImports_jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { + name.bridgeJSWithLoweredParameter { (nameIsSome, nameBytes, nameLength) in + bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(nameIsSome, nameBytes, nameLength) + } + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() +} + +func _$OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull(_ v: Optional<[JSValue]>) throws(JSException) -> Optional<[JSValue]> { + let vIsSome = v.bridgeJSLowerParameter() + bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static(vIsSome) + if let error = _swift_js_take_exception() { + throw error + } + return Optional<[JSValue]>.bridgeJSLiftReturn() +} + +func _$OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined(_ v: JSUndefinedOr<[JSValue]>) throws(JSException) -> JSUndefinedOr<[JSValue]> { + let vIsSome = v.bridgeJSLowerParameter() + bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static(vIsSome) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr<[JSValue]>.bridgeJSLiftReturn() +} + +func _$OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull(_ v: Optional<[String: String]>) throws(JSException) -> Optional<[String: String]> { + let vIsSome = v.bridgeJSLowerParameter() + bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static(vIsSome) + if let error = _swift_js_take_exception() { + throw error + } + return Optional<[String: String]>.bridgeJSLiftReturn() +} + +func _$OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined(_ v: JSUndefinedOr<[String: String]>) throws(JSException) -> JSUndefinedOr<[String: String]> { + let vIsSome = v.bridgeJSLowerParameter() + bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static(vIsSome) + if let error = _swift_js_take_exception() { + throw error + } + return JSUndefinedOr<[String: String]>.bridgeJSLiftReturn() +} + +func _$OptionalSupportImports_runJsOptionalSupportTests() throws(JSException) -> Void { + bjs_OptionalSupportImports_runJsOptionalSupportTests_static() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_gc") +fileprivate func bjs_gc_extern() -> Void +#else +fileprivate func bjs_gc_extern() -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_gc() -> Void { + return bjs_gc_extern() +} + +func _$gc() throws(JSException) -> Void { + bjs_gc() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsRoundTripGreeter_static") +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static_extern(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static_extern(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + return bjs_SwiftClassSupportImports_jsRoundTripGreeter_static_extern(greeter) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsRoundTripUUID_static") +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripUUID_static_extern(_ uuid: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripUUID_static_extern(_ uuid: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsRoundTripUUID_static(_ uuid: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + return bjs_SwiftClassSupportImports_jsRoundTripUUID_static_extern(uuid) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static") +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static_extern(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer +#else +fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static_extern(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + return bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static_extern(greeterIsSome, greeterPointer) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static") +fileprivate func bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static_extern(_ value: UnsafeMutableRawPointer) -> Void +#else +fileprivate func bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static_extern(_ value: UnsafeMutableRawPointer) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static(_ value: UnsafeMutableRawPointer) -> Void { + return bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static_extern(value) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static") +fileprivate func bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static_extern(_ valueIsSome: Int32, _ valuePointer: UnsafeMutableRawPointer) -> Void +#else +fileprivate func bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static_extern(_ valueIsSome: Int32, _ valuePointer: UnsafeMutableRawPointer) -> Void { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static(_ valueIsSome: Int32, _ valuePointer: UnsafeMutableRawPointer) -> Void { + return bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static_extern(valueIsSome, valuePointer) +} + +func _$SwiftClassSupportImports_jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter { + let greeterPointer = greeter.bridgeJSLowerParameter() + let ret = bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(greeterPointer) + if let error = _swift_js_take_exception() { + throw error + } + return Greeter.bridgeJSLiftReturn(ret) +} + +func _$SwiftClassSupportImports_jsRoundTripUUID(_ uuid: UUID) throws(JSException) -> UUID { + let uuidPointer = uuid.bridgeJSLowerParameter() + let ret = bjs_SwiftClassSupportImports_jsRoundTripUUID_static(uuidPointer) + if let error = _swift_js_take_exception() { + throw error + } + return UUID.bridgeJSLiftReturn(ret) +} + +func _$SwiftClassSupportImports_jsRoundTripOptionalGreeter(_ greeter: Optional) throws(JSException) -> Optional { + let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameter() + let ret = bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static(greeterIsSome, greeterPointer) + if let error = _swift_js_take_exception() { + throw error + } + return Optional.bridgeJSLiftReturn(ret) +} + +func _$SwiftClassSupportImports_jsConsumeLeakCheck(_ value: LeakCheck) throws(JSException) -> Void { + let valuePointer = value.bridgeJSLowerParameter() + bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static(valuePointer) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$SwiftClassSupportImports_jsConsumeOptionalLeakCheck(_ value: Optional) throws(JSException) -> Void { + let (valueIsSome, valuePointer) = value.bridgeJSLowerParameter() + bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static(valueIsSome, valuePointer) + if let error = _swift_js_take_exception() { + throw error + } +} \ No newline at end of file diff --git a/Tests/BridgeJSIdentityTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSIdentityTests/Generated/JavaScript/BridgeJS.json new file mode 100644 index 000000000..ccca68ceb --- /dev/null +++ b/Tests/BridgeJSIdentityTests/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,20907 @@ +{ + "exported" : { + "classes" : [ + { + "methods" : [ + { + "abiName" : "bjs_ClosureSupportExports_static_makeIntToInt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeIntToInt", + "parameters" : [ + { + "label" : "_", + "name" : "base", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" + } + } + }, + { + "abiName" : "bjs_ClosureSupportExports_static_makeDoubleToDouble", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeDoubleToDouble", + "parameters" : [ + { + "label" : "_", + "name" : "base", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "double" : { + + } + } + ], + "returnType" : { + "double" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" + } + } + }, + { + "abiName" : "bjs_ClosureSupportExports_static_makeStringToString", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeStringToString", + "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" + } + } + }, + { + "abiName" : "bjs_ClosureSupportExports_static_makeJSIntToInt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeJSIntToInt", + "parameters" : [ + { + "label" : "_", + "name" : "base", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" + } + } + }, + { + "abiName" : "bjs_ClosureSupportExports_static_makeJSDoubleToDouble", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeJSDoubleToDouble", + "parameters" : [ + { + "label" : "_", + "name" : "base", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "double" : { + + } + } + ], + "returnType" : { + "double" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" + } + } + }, + { + "abiName" : "bjs_ClosureSupportExports_static_makeJSStringToString", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeJSStringToString", + "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + }, + "staticContext" : { + "className" : { + "_0" : "ClosureSupportExports" + } + } + } + ], + "name" : "ClosureSupportExports", + "properties" : [ + + ], + "swiftCallName" : "ClosureSupportExports" + }, + { + "constructor" : { + "abiName" : "bjs_DefaultArgumentConstructorDefaults_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Default" + } + }, + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "int" : { + "_0" : 42 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + }, + { + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "success" + } + }, + "label" : "status", + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "tag", + "name" : "tag", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_DefaultArgumentConstructorDefaults_describe", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "describe", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "DefaultArgumentConstructorDefaults", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "enabled", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "tag", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "DefaultArgumentConstructorDefaults" + }, + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "explicitAccessControl" : "public", + "methods" : [ + { + "abiName" : "bjs_Greeter_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_Greeter_changeName", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "changeName", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_Greeter_greetWith", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greetWith", + "parameters" : [ + { + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "label" : "customGreeting", + "name" : "customGreeting", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_Greeter_makeFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFormatter", + "parameters" : [ + { + "label" : "suffix", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_Greeter_static_makeCreator", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeCreator", + "parameters" : [ + { + "label" : "defaultName", + "name" : "defaultName", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + }, + "staticContext" : { + "className" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_Greeter_makeCustomGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeCustomGreeter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_Greeter_greetEnthusiastically", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greetEnthusiastically", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_Greeter_static_greetAnonymously", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "greetAnonymously", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "Greeter" + } + } + } + ], + "name" : "Greeter", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "prefix", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "nameCount", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "defaultGreeting", + "staticContext" : { + "className" : { + "_0" : "Greeter" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "Greeter" + }, + { + "methods" : [ + { + "abiName" : "bjs_Calculator_square", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "square", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_Calculator_add", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "name" : "Calculator", + "properties" : [ + + ], + "swiftCallName" : "Calculator" + }, + { + "explicitAccessControl" : "internal", + "methods" : [ + + ], + "name" : "InternalGreeter", + "properties" : [ + + ], + "swiftCallName" : "InternalGreeter" + }, + { + "explicitAccessControl" : "public", + "methods" : [ + + ], + "name" : "PublicGreeter", + "properties" : [ + + ], + "swiftCallName" : "PublicGreeter" + }, + { + "explicitAccessControl" : "package", + "methods" : [ + + ], + "name" : "PackageGreeter", + "properties" : [ + + ], + "swiftCallName" : "PackageGreeter" + }, + { + "constructor" : { + "abiName" : "bjs_Utils_Converter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Utils_Converter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "namespace" : [ + "Utils" + ], + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Converter", + "namespace" : [ + "Utils" + ], + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "precision", + "namespace" : [ + "Utils" + ], + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "Utils.Converter" + }, + { + "constructor" : { + "abiName" : "bjs_Networking_API_HTTPServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Networking_API_HTTPServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "Networking", + "API" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "HTTPServer", + "namespace" : [ + "Networking", + "API" + ], + "properties" : [ + + ], + "swiftCallName" : "Networking.API.HTTPServer" + }, + { + "constructor" : { + "abiName" : "bjs___Swift_Foundation_UUID_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs___Swift_Foundation_UUID_uuidString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "uuidString", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs___Swift_Foundation_UUID_static_fromValue", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "fromValue", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "UUID" + } + }, + "staticContext" : { + "className" : { + "_0" : "__Swift_Foundation_UUID" + } + } + } + ], + "name" : "UUID", + "namespace" : [ + "__Swift", + "Foundation" + ], + "properties" : [ + { + "isReadonly" : true, + "isStatic" : true, + "name" : "placeholder", + "staticContext" : { + "className" : { + "_0" : "__Swift_Foundation_UUID" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "UUID" + }, + { + "constructor" : { + "abiName" : "bjs_Networking_APIV2_Internal_TestServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Networking_APIV2_Internal_TestServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "Networking", + "APIV2", + "Internal" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Internal.SupportedMethod" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "TestServer", + "namespace" : [ + "Networking", + "APIV2", + "Internal" + ], + "properties" : [ + + ], + "swiftCallName" : "Internal.TestServer" + }, + { + "constructor" : { + "abiName" : "bjs_SimplePropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "SimplePropertyHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "SimplePropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_PropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "intValue", + "name" : "intValue", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "floatValue", + "name" : "floatValue", + "type" : { + "float" : { + + } + } + }, + { + "label" : "doubleValue", + "name" : "doubleValue", + "type" : { + "double" : { + + } + } + }, + { + "label" : "boolValue", + "name" : "boolValue", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "stringValue", + "name" : "stringValue", + "type" : { + "string" : { + + } + } + }, + { + "label" : "jsObject", + "name" : "jsObject", + "type" : { + "jsObject" : { + + } + } + }, + { + "label" : "sibling", + "name" : "sibling", + "type" : { + "swiftHeapObject" : { + "_0" : "SimplePropertyHolder" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_PropertyHolder_getAllValues", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAllValues", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PropertyHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "intValue", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "floatValue", + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "doubleValue", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "boolValue", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "stringValue", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyInt", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyFloat", + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyDouble", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyBool", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyString", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "jsObject", + "type" : { + "jsObject" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "sibling", + "type" : { + "swiftHeapObject" : { + "_0" : "SimplePropertyHolder" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "lazyValue", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "computedReadonly", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "computedReadWrite", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "observedProperty", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "PropertyHolder" + }, + { + "methods" : [ + { + "abiName" : "bjs_MathUtils_static_add", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + }, + { + "abiName" : "bjs_MathUtils_static_substract", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "substract", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + } + ], + "name" : "MathUtils", + "properties" : [ + + ], + "swiftCallName" : "MathUtils" + }, + { + "constructor" : { + "abiName" : "bjs_StaticPropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "StaticPropertyHolder", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : true, + "name" : "staticConstant", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticVariable", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticString", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticBool", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticFloat", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticDouble", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedProperty", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "readOnlyComputed", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "optionalString", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "optionalInt", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "jsObjectProperty", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "jsObject" : { + + } + } + } + ], + "swiftCallName" : "StaticPropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_DataProcessorManager_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "processor", + "name" : "processor", + "type" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_DataProcessorManager_incrementByAmount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "incrementByAmount", + "parameters" : [ + { + "label" : "_", + "name" : "amount", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorLabel", + "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_isProcessorEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isProcessorEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorLabel", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getCurrentValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getCurrentValue", + "parameters" : [ + + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_incrementBoth", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "incrementBoth", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getBackupValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getBackupValue", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_hasBackup", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "hasBackup", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorOptionalTag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorOptionalTag", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorOptionalTag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorOptionalTag", + "parameters" : [ + { + "label" : "_", + "name" : "tag", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorOptionalCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorOptionalCount", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorOptionalCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorOptionalCount", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorDirection", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorTheme", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorHttpStatus", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "status", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorAPIResult", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "apiResult", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "DataProcessorManager", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "processor", + "type" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "backupProcessor", + "type" : { + "nullable" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "DataProcessorManager" + }, + { + "constructor" : { + "abiName" : "bjs_SwiftDataProcessor_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_SwiftDataProcessor_increment", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "increment", + "parameters" : [ + { + "label" : "by", + "name" : "amount", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_getValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getValue", + "parameters" : [ + + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_setLabelElements", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setLabelElements", + "parameters" : [ + { + "label" : "_", + "name" : "labelPrefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "labelSuffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_getLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getLabel", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_isEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_processGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_createGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createGreeter", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_processOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_createOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalGreeter", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_handleAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_getAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAPIResult", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "SwiftDataProcessor", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalTag", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalCount", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "direction", + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalTheme", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "httpStatus", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "apiResult", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalHelper", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "SwiftDataProcessor" + }, + { + "methods" : [ + { + "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessor", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "createNativeProcessor", + "parameters" : [ + + ], + "returnType" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + }, + "staticContext" : { + "className" : { + "_0" : "ProtocolReturnTests" + } + } + }, + { + "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessorOptional", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "createNativeProcessorOptional", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "className" : { + "_0" : "ProtocolReturnTests" + } + } + }, + { + "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessorNil", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "createNativeProcessorNil", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "className" : { + "_0" : "ProtocolReturnTests" + } + } + }, + { + "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessorArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "createNativeProcessorArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + } + }, + "staticContext" : { + "className" : { + "_0" : "ProtocolReturnTests" + } + } + }, + { + "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessorDictionary", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "createNativeProcessorDictionary", + "parameters" : [ + + ], + "returnType" : { + "dictionary" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + } + }, + "staticContext" : { + "className" : { + "_0" : "ProtocolReturnTests" + } + } + } + ], + "name" : "ProtocolReturnTests", + "properties" : [ + + ], + "swiftCallName" : "ProtocolReturnTests" + }, + { + "constructor" : { + "abiName" : "bjs_TextProcessor_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "transform", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_TextProcessor_process", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "process", + "parameters" : [ + { + "label" : "_", + "name" : "text", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processWithCustom", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processWithCustom", + "parameters" : [ + { + "label" : "_", + "name" : "text", + "type" : { + "string" : { + + } + } + }, + { + "label" : "customTransform", + "name" : "customTransform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSiSSSd_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + { + "string" : { + + } + }, + { + "double" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_getTransform", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTransform", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalString", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalInt", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSqSi_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeOptionalStringFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalStringFormatter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeOptionalGreeterCreator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalGreeterCreator", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_Sq7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_processDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDirection", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests9DirectionO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processTheme", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests5ThemeO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_processAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeDirectionChecker", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeDirectionChecker", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests9DirectionO_Sb", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "bool" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeThemeValidator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeThemeValidator", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests5ThemeO_Sb", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "bool" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeStatusCodeExtractor", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStatusCodeExtractor", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeAPIResultHandler", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultHandler", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalDirection", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalTheme", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq5ThemeO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq9APIResultO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeOptionalDirectionFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalDirectionFormatter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_processDataProcessor", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDataProcessor", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests13DataProcessorP_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeDataProcessorFactory", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeDataProcessorFactory", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_13DataProcessorP", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_roundtripDataProcessor", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripDataProcessor", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + ], + "returnType" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + ], + "returnType" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalDataProcessor", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalDataProcessor", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq13DataProcessorP_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "TextProcessor", + "properties" : [ + + ], + "swiftCallName" : "TextProcessor" + }, + { + "constructor" : { + "abiName" : "bjs_IdentityTestSubject_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "IdentityTestSubject", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "currentValue", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "IdentityTestSubject" + }, + { + "constructor" : { + "abiName" : "bjs_RetainLeakSubject_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "tag", + "name" : "tag", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "RetainLeakSubject", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "tag", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "RetainLeakSubject" + }, + { + "constructor" : { + "abiName" : "bjs_ArrayIdentityElement_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "tag", + "name" : "tag", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "ArrayIdentityElement", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "tag", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "ArrayIdentityElement" + }, + { + "constructor" : { + "abiName" : "bjs_OptionalHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "nullableGreeter", + "name" : "nullableGreeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + { + "label" : "undefinedNumber", + "name" : "undefinedNumber", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "undefined" + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "OptionalHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "nullableGreeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "undefinedNumber", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "swiftCallName" : "OptionalHolder" + }, + { + "constructor" : { + "abiName" : "bjs_OptionalPropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "optionalName", + "name" : "optionalName", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "OptionalPropertyHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalName", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalAge", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalGreeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "OptionalPropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_Container_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "location", + "name" : "location", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "label" : "config", + "name" : "config", + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + }, + "_1" : "null" + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "Container", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "location", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "config", + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "Container" + }, + { + "constructor" : { + "abiName" : "bjs_LeakCheck_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "explicitAccessControl" : "public", + "methods" : [ + + ], + "name" : "LeakCheck", + "properties" : [ + + ], + "swiftCallName" : "LeakCheck" + } + ], + "enums" : [ + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "ArraySupportExports", + "staticMethods" : [ + { + "abiName" : "bjs_ArraySupportExports_static_roundTripIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripIntArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripStringArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripDoubleArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripDoubleArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripBoolArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripBoolArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripUnsafeRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUnsafeRawPointerArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripUnsafeMutableRawPointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUnsafeMutableRawPointerArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOpaquePointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOpaquePointerArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripUnsafePointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUnsafePointerArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripUnsafeMutablePointerArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUnsafeMutablePointerArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripJSValueArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripJSValueArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripJSObjectArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripJSObjectArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripCaseEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripCaseEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripStringRawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripStringRawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripIntRawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripIntRawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt64RawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt64RawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripStructArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripStructArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripSwiftClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripSwiftClassArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripNamespacedSwiftClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripNamespacedSwiftClassArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Utils.Converter" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Utils.Converter" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripProtocolArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripProtocolArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "ArrayElementProtocol" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftProtocol" : { + "_0" : "ArrayElementProtocol" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripJSClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripJSClassArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "jsObject" : { + "_0" : "ArrayElementObject" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsObject" : { + "_0" : "ArrayElementObject" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalIntArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalStringArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalJSObjectArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalJSObjectArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalCaseEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalCaseEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalStringRawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalStringRawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalIntRawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalIntRawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalInt64RawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalUInt64RawValueEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalStructArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalStructArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalSwiftClassArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalJSClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalJSClassArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "ArrayElementObject" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "ArrayElementObject" + } + }, + "_1" : "null" + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripNestedIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripNestedIntArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripNestedStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripNestedStringArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripNestedDoubleArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripNestedDoubleArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripNestedBoolArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripNestedBoolArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripNestedStructArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripNestedStructArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripNestedCaseEnumArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripNestedCaseEnumArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_roundTripNestedSwiftClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripNestedSwiftClassArray", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_multiArrayFirst", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "multiArrayFirst", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "a", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "label" : "_", + "name" : "b", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_multiArraySecond", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "multiArraySecond", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "a", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "label" : "_", + "name" : "b", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_multiOptionalArrayFirst", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "multiOptionalArrayFirst", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "a", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + }, + "_1" : "null" + } + } + }, + { + "label" : "_", + "name" : "b", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + }, + { + "abiName" : "bjs_ArraySupportExports_static_multiOptionalArraySecond", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "multiOptionalArraySecond", + "namespace" : [ + "ArraySupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "a", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + }, + "_1" : "null" + } + } + }, + { + "label" : "_", + "name" : "b", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "ArraySupportExports" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "ArraySupportExports", + "tsFullPath" : "ArraySupportExports" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "DefaultArgumentExports", + "staticMethods" : [ + { + "abiName" : "bjs_DefaultArgumentExports_static_testStringDefault", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testStringDefault", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Hello World" + } + }, + "label" : "message", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_testIntDefault", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testIntDefault", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "int" : { + "_0" : 42 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_testBoolDefault", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testBoolDefault", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "flag", + "name" : "flag", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_testOptionalDefault", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testOptionalDefault", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "name", + "name" : "name", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_testMultipleDefaults", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testMultipleDefaults", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Default Title" + } + }, + "label" : "title", + "name" : "title", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "int" : { + "_0" : -10 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : false + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_testSimpleEnumDefault", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testSimpleEnumDefault", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "success" + } + }, + "label" : "status", + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Status" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_testDirectionDefault", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testDirectionDefault", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Direction", + "_1" : "north" + } + }, + "label" : "direction", + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_testRawStringEnumDefault", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testRawStringEnumDefault", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Theme", + "_1" : "light" + } + }, + "label" : "theme", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_testComplexInit", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testComplexInit", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "objectWithArguments" : { + "_0" : "Greeter", + "_1" : [ + { + "string" : { + "_0" : "DefaultGreeter" + } + } + ] + } + }, + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_testEmptyInit", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "testEmptyInit", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "object" : { + "_0" : "StaticPropertyHolder" + } + }, + "label" : "_", + "name" : "object", + "type" : { + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_createConstructorDefaults", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "createConstructorDefaults", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Default" + } + }, + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "int" : { + "_0" : 42 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + }, + { + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "success" + } + }, + "label" : "status", + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "tag", + "name" : "tag", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "DefaultArgumentConstructorDefaults" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_describeConstructorDefaults", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "describeConstructorDefaults", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "DefaultArgumentConstructorDefaults" + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_arrayWithDefault", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "arrayWithDefault", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 1 + } + }, + { + "int" : { + "_0" : 2 + } + }, + { + "int" : { + "_0" : 3 + } + } + ] + } + }, + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_arrayWithOptionalDefault", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "arrayWithOptionalDefault", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "_", + "name" : "values", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + }, + { + "abiName" : "bjs_DefaultArgumentExports_static_arrayMixedDefaults", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "arrayMixedDefaults", + "namespace" : [ + "DefaultArgumentExports" + ], + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Sum" + } + }, + "label" : "prefix", + "name" : "prefix", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "array" : { + "_0" : [ + { + "int" : { + "_0" : 10 + } + }, + { + "int" : { + "_0" : 20 + } + } + ] + } + }, + "label" : "values", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "defaultValue" : { + "string" : { + "_0" : "!" + } + }, + "label" : "suffix", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "DefaultArgumentExports" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "DefaultArgumentExports", + "tsFullPath" : "DefaultArgumentExports" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" + }, + { + "associatedValues" : [ + + ], + "name" : "east" + }, + { + "associatedValues" : [ + + ], + "name" : "west" + } + ], + "emitStyle" : "const", + "name" : "Direction", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Direction", + "tsFullPath" : "Direction" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "loading" + }, + { + "associatedValues" : [ + + ], + "name" : "success" + }, + { + "associatedValues" : [ + + ], + "name" : "error" + } + ], + "emitStyle" : "const", + "name" : "Status", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Status", + "tsFullPath" : "Status" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "light", + "rawValue" : "light" + }, + { + "associatedValues" : [ + + ], + "name" : "dark", + "rawValue" : "dark" + }, + { + "associatedValues" : [ + + ], + "name" : "auto", + "rawValue" : "auto" + } + ], + "emitStyle" : "const", + "name" : "Theme", + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Theme", + "tsFullPath" : "Theme" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "ok", + "rawValue" : "200" + }, + { + "associatedValues" : [ + + ], + "name" : "notFound", + "rawValue" : "404" + }, + { + "associatedValues" : [ + + ], + "name" : "serverError", + "rawValue" : "500" + }, + { + "associatedValues" : [ + + ], + "name" : "unknown", + "rawValue" : "-1" + } + ], + "emitStyle" : "const", + "name" : "HttpStatus", + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "HttpStatus", + "tsFullPath" : "HttpStatus" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "tiny", + "rawValue" : "1024" + }, + { + "associatedValues" : [ + + ], + "name" : "small", + "rawValue" : "10240" + }, + { + "associatedValues" : [ + + ], + "name" : "medium", + "rawValue" : "102400" + }, + { + "associatedValues" : [ + + ], + "name" : "large", + "rawValue" : "1048576" + } + ], + "emitStyle" : "const", + "name" : "FileSize", + "rawType" : "Int64", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "FileSize", + "tsFullPath" : "FileSize" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "none", + "rawValue" : "0" + }, + { + "associatedValues" : [ + + ], + "name" : "active", + "rawValue" : "9876543210" + }, + { + "associatedValues" : [ + + ], + "name" : "expired", + "rawValue" : "1234567890" + } + ], + "emitStyle" : "const", + "name" : "SessionId", + "rawType" : "UInt64", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "SessionId", + "tsFullPath" : "SessionId" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "rough", + "rawValue" : "0.1" + }, + { + "associatedValues" : [ + + ], + "name" : "normal", + "rawValue" : "0.01" + }, + { + "associatedValues" : [ + + ], + "name" : "fine", + "rawValue" : "0.001" + } + ], + "emitStyle" : "const", + "name" : "Precision", + "rawType" : "Float", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Precision", + "tsFullPath" : "Precision" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "quarter", + "rawValue" : "0.25" + }, + { + "associatedValues" : [ + + ], + "name" : "half", + "rawValue" : "0.5" + }, + { + "associatedValues" : [ + + ], + "name" : "golden", + "rawValue" : "1.618" + } + ], + "emitStyle" : "const", + "name" : "Ratio", + "rawType" : "Double", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Ratio", + "tsFullPath" : "Ratio" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" + }, + { + "associatedValues" : [ + + ], + "name" : "east" + }, + { + "associatedValues" : [ + + ], + "name" : "west" + } + ], + "emitStyle" : "tsEnum", + "name" : "TSDirection", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "TSDirection", + "tsFullPath" : "TSDirection" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "light", + "rawValue" : "light" + }, + { + "associatedValues" : [ + + ], + "name" : "dark", + "rawValue" : "dark" + }, + { + "associatedValues" : [ + + ], + "name" : "auto", + "rawValue" : "auto" + } + ], + "emitStyle" : "tsEnum", + "name" : "TSTheme", + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "TSTheme", + "tsFullPath" : "TSTheme" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "StringUtils", + "namespace" : [ + "Utils" + ], + "staticMethods" : [ + { + "abiName" : "bjs_Utils_StringUtils_static_uppercase", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "uppercase", + "namespace" : [ + "Utils", + "StringUtils" + ], + "parameters" : [ + { + "label" : "_", + "name" : "text", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "Utils.StringUtils" + } + } + }, + { + "abiName" : "bjs_Utils_StringUtils_static_lowercase", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "lowercase", + "namespace" : [ + "Utils", + "StringUtils" + ], + "parameters" : [ + { + "label" : "_", + "name" : "text", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "Utils.StringUtils" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils.StringUtils", + "tsFullPath" : "Utils.StringUtils" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Networking", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Networking", + "tsFullPath" : "Networking" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "API", + "namespace" : [ + "Networking" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Networking.API", + "tsFullPath" : "Networking.API" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + }, + { + "associatedValues" : [ + + ], + "name" : "put" + }, + { + "associatedValues" : [ + + ], + "name" : "delete" + } + ], + "emitStyle" : "const", + "name" : "Method", + "namespace" : [ + "Networking", + "API" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Networking.API.Method", + "tsFullPath" : "Networking.API.Method" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Configuration", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Configuration", + "tsFullPath" : "Configuration" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "debug", + "rawValue" : "debug" + }, + { + "associatedValues" : [ + + ], + "name" : "info", + "rawValue" : "info" + }, + { + "associatedValues" : [ + + ], + "name" : "warning", + "rawValue" : "warning" + }, + { + "associatedValues" : [ + + ], + "name" : "error", + "rawValue" : "error" + } + ], + "emitStyle" : "const", + "name" : "LogLevel", + "namespace" : [ + "Configuration" + ], + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Configuration.LogLevel", + "tsFullPath" : "Configuration.LogLevel" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "http", + "rawValue" : "80" + }, + { + "associatedValues" : [ + + ], + "name" : "https", + "rawValue" : "443" + }, + { + "associatedValues" : [ + + ], + "name" : "development", + "rawValue" : "3000" + } + ], + "emitStyle" : "const", + "name" : "Port", + "namespace" : [ + "Configuration" + ], + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Configuration.Port", + "tsFullPath" : "Configuration.Port" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Internal", + "namespace" : [ + "Networking", + "APIV2" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal", + "tsFullPath" : "Networking.APIV2.Internal" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + } + ], + "emitStyle" : "const", + "name" : "SupportedMethod", + "namespace" : [ + "Networking", + "APIV2", + "Internal" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal.SupportedMethod", + "tsFullPath" : "Networking.APIV2.Internal.SupportedMethod" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + } + ], + "name" : "flag" + }, + { + "associatedValues" : [ + { + "type" : { + "float" : { + + } + } + } + ], + "name" : "rate" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + } + ], + "name" : "precise" + }, + { + "associatedValues" : [ + + ], + "name" : "info" + } + ], + "emitStyle" : "const", + "name" : "APIResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "name" : "error" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "location" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "status" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + } + ], + "name" : "coordinates" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "comprehensive" + }, + { + "associatedValues" : [ + + ], + "name" : "info" + } + ], + "emitStyle" : "const", + "name" : "ComplexResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "ComplexResult", + "tsFullPath" : "ComplexResult" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utilities", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utilities", + "tsFullPath" : "Utilities" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "status" + } + ], + "emitStyle" : "const", + "name" : "Result", + "namespace" : [ + "Utilities" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utilities.Result", + "tsFullPath" : "Utilities.Result" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "API", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "API", + "tsFullPath" : "API" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "name" : "failure" + } + ], + "emitStyle" : "const", + "name" : "NetworkingResult", + "namespace" : [ + "API" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "API.NetworkingResult", + "tsFullPath" : "API.NetworkingResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + ], + "name" : "structPayload" + }, + { + "associatedValues" : [ + { + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "name" : "classPayload" + }, + { + "associatedValues" : [ + { + "type" : { + "jsObject" : { + + } + } + } + ], + "name" : "jsObjectPayload" + }, + { + "associatedValues" : [ + { + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "name" : "nestedEnum" + }, + { + "associatedValues" : [ + { + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "name" : "arrayPayload" + }, + { + "associatedValues" : [ + { + "type" : { + "jsObject" : { + "_0" : "Foo" + } + } + } + ], + "name" : "jsClassPayload" + }, + { + "associatedValues" : [ + + ], + "name" : "empty" + } + ], + "emitStyle" : "const", + "name" : "AllTypesResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "AllTypesResult", + "tsFullPath" : "AllTypesResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + } + ], + "name" : "precision" + }, + { + "associatedValues" : [ + { + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + ], + "name" : "direction" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optPrecision" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optDirection" + }, + { + "associatedValues" : [ + + ], + "name" : "empty" + } + ], + "emitStyle" : "const", + "name" : "TypedPayloadResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "TypedPayloadResult", + "tsFullPath" : "TypedPayloadResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "scientific" + }, + { + "associatedValues" : [ + + ], + "name" : "basic" + } + ], + "emitStyle" : "const", + "name" : "StaticCalculator", + "staticMethods" : [ + { + "abiName" : "bjs_StaticCalculator_static_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "enumName" : { + "_0" : "StaticCalculator" + } + } + }, + { + "abiName" : "bjs_StaticCalculator_static_doubleValue", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "doubleValue", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "enumName" : { + "_0" : "StaticCalculator" + } + } + } + ], + "staticProperties" : [ + { + "isReadonly" : true, + "isStatic" : true, + "name" : "version", + "staticContext" : { + "enumName" : { + "_0" : "StaticCalculator" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "StaticCalculator", + "tsFullPath" : "StaticCalculator" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "StaticUtils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "StaticUtils", + "tsFullPath" : "StaticUtils" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Nested", + "namespace" : [ + "StaticUtils" + ], + "staticMethods" : [ + { + "abiName" : "bjs_StaticUtils_Nested_static_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundtrip", + "namespace" : [ + "StaticUtils", + "Nested" + ], + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "StaticUtils.Nested" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "StaticUtils.Nested", + "tsFullPath" : "StaticUtils.Nested" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GraphOperations", + "namespace" : [ + "Services", + "Graph" + ], + "staticMethods" : [ + { + "abiName" : "bjs_Services_Graph_GraphOperations_static_createGraph", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "createGraph", + "namespace" : [ + "Services", + "Graph", + "GraphOperations" + ], + "parameters" : [ + { + "label" : "rootId", + "name" : "rootId", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + }, + { + "abiName" : "bjs_Services_Graph_GraphOperations_static_nodeCount", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "nodeCount", + "namespace" : [ + "Services", + "Graph", + "GraphOperations" + ], + "parameters" : [ + { + "label" : "graphId", + "name" : "graphId", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "GraphOperations" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GraphOperations", + "tsFullPath" : "Services.Graph.GraphOperations" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "option1" + }, + { + "associatedValues" : [ + + ], + "name" : "option2" + } + ], + "emitStyle" : "const", + "name" : "StaticPropertyEnum", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumProperty", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "enumConstant", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumBool", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumVariable", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "computedReadonly", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedReadWrite", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "StaticPropertyEnum", + "tsFullPath" : "StaticPropertyEnum" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "StaticPropertyNamespace", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "namespaceProperty", + "namespace" : [ + "StaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "StaticPropertyNamespace" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "namespaceConstant", + "namespace" : [ + "StaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "StaticPropertyNamespace" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "StaticPropertyNamespace", + "tsFullPath" : "StaticPropertyNamespace" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "NestedProperties", + "namespace" : [ + "StaticPropertyNamespace" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedProperty", + "namespace" : [ + "StaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "StaticPropertyNamespace.NestedProperties" + } + }, + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "nestedConstant", + "namespace" : [ + "StaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "StaticPropertyNamespace.NestedProperties" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedDouble", + "namespace" : [ + "StaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + "_0" : "StaticPropertyNamespace.NestedProperties" + } + }, + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "StaticPropertyNamespace.NestedProperties", + "tsFullPath" : "StaticPropertyNamespace.NestedProperties" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "IntegerTypesSupportExports", + "staticMethods" : [ + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt8", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt8", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt8", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt8", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt16", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt16", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt16", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt16", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt32", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt32", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt32", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt32", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt64", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripInt64", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + }, + { + "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt64", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripUInt64", + "namespace" : [ + "IntegerTypesSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "IntegerTypesSupportExports" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "IntegerTypesSupportExports", + "tsFullPath" : "IntegerTypesSupportExports" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "OptionalSupportExports", + "staticMethods" : [ + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalString", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalString", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalInt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalInt", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalBool", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalBool", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalFloat", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalFloat", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "float" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "float" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalDouble", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalDouble", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalSyntax", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalCaseEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalStringRawValueEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalIntRawValueEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalInt64RawValueEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalUInt64RawValueEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTSEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalTSEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "TSDirection" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "TSDirection" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalTSStringEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalNamespacedEnum", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalSwiftClass", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalIntArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalIntArray", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalStringArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalStringArray", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalSwiftClassArray", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalTypedPayloadResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalComplexResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalComplexResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalAllTypesResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalPayloadResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalPayloadResultOpt", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "OptionalAllTypesResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIOptionalResult", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_takeOptionalJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "takeOptionalJSObject", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_applyOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "applyOptionalGreeter", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + { + "label" : "_", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_makeOptionalHolder", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeOptionalHolder", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "nullableGreeter", + "name" : "nullableGreeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + { + "label" : "undefinedNumber", + "name" : "undefinedNumber", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "OptionalHolder" + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + }, + { + "abiName" : "bjs_OptionalSupportExports_static_compareAPIResults", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "compareAPIResults", + "namespace" : [ + "OptionalSupportExports" + ], + "parameters" : [ + { + "label" : "_", + "name" : "r1", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + { + "label" : "_", + "name" : "r2", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + "_0" : "OptionalSupportExports" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "OptionalSupportExports", + "tsFullPath" : "OptionalSupportExports" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Address" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optStruct" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optClass" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optJSObject" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optNestedEnum" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optArray" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "optJsClass" + }, + { + "associatedValues" : [ + + ], + "name" : "empty" + } + ], + "emitStyle" : "const", + "name" : "OptionalAllTypesResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "OptionalAllTypesResult", + "tsFullPath" : "OptionalAllTypesResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "status" + } + ], + "emitStyle" : "const", + "name" : "APIOptionalResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIOptionalResult", + "tsFullPath" : "APIOptionalResult" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundTripVoid", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_roundTripFloat", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripFloat", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "float" : { + + } + } + } + ], + "returnType" : { + "float" : { + + } + } + }, + { + "abiName" : "bjs_roundTripDouble", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDouble", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_roundTripBool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripBool", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_roundTripString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripString", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_roundTripSwiftHeapObject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripSwiftHeapObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeRawPointer", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + } + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeMutableRawPointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeMutableRawPointer", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + } + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + }, + { + "abiName" : "bjs_roundTripOpaquePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOpaquePointer", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + } + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + }, + { + "abiName" : "bjs_roundTripUnsafePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafePointer", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + } + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + }, + { + "abiName" : "bjs_roundTripUnsafeMutablePointer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUnsafeMutablePointer", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + } + ], + "returnType" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + }, + { + "abiName" : "bjs_roundTripJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripJSObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_roundTripDictionaryExport", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDictionaryExport", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "dictionary" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalDictionaryExport", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalDictionaryExport", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripJSValue", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "jsValue" : { + + } + } + } + ], + "returnType" : { + "jsValue" : { + + } + } + }, + { + "abiName" : "bjs_roundTripOptionalJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalJSValue", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalJSValueArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalJSValueArray", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_makeImportedFoo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "makeImportedFoo", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + "_0" : "Foo" + } + } + }, + { + "abiName" : "bjs_throwsSwiftError", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsSwiftError", + "parameters" : [ + { + "label" : "shouldThrow", + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithIntResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithIntResult", + "parameters" : [ + + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_throwsWithStringResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithStringResult", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithBoolResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithBoolResult", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithFloatResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithFloatResult", + "parameters" : [ + + ], + "returnType" : { + "float" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithDoubleResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithDoubleResult", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithSwiftHeapObjectResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithSwiftHeapObjectResult", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_throwsWithJSObjectResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithJSObjectResult", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripVoid", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripInt", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripInt", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_asyncRoundTripFloat", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripFloat", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "float" : { + + } + } + } + ], + "returnType" : { + "float" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripDouble", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripDouble", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripBool", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripBool", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripString", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripString", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripSwiftHeapObject", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripSwiftHeapObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_asyncRoundTripJSObject", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripJSObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_takeGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeGreeter", + "parameters" : [ + { + "label" : "g", + "name" : "g", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_createCalculator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createCalculator", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Calculator" + } + } + }, + { + "abiName" : "bjs_useCalculator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "useCalculator", + "parameters" : [ + { + "label" : "calc", + "name" : "calc", + "type" : { + "swiftHeapObject" : { + "_0" : "Calculator" + } + } + }, + { + "label" : "x", + "name" : "x", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_testGreeterToJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testGreeterToJSValue", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_testCalculatorToJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testCalculatorToJSValue", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_testSwiftClassAsJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testSwiftClassAsJSValue", + "parameters" : [ + { + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_setDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "abiName" : "bjs_getDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getDirection", + "parameters" : [ + + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "abiName" : "bjs_processDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDirection", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "abiName" : "bjs_setTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_getTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTheme", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_setHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "status", + "type" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_getHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getHttpStatus", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_setFileSize", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setFileSize", + "parameters" : [ + { + "label" : "_", + "name" : "size", + "type" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + }, + { + "abiName" : "bjs_getFileSize", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getFileSize", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "FileSize", + "_1" : "Int64" + } + } + }, + { + "abiName" : "bjs_setSessionId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setSessionId", + "parameters" : [ + { + "label" : "_", + "name" : "session", + "type" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + }, + { + "abiName" : "bjs_getSessionId", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getSessionId", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "SessionId", + "_1" : "UInt64" + } + } + }, + { + "abiName" : "bjs_processTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_setTSDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTSDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + }, + { + "abiName" : "bjs_getTSDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTSDirection", + "parameters" : [ + + ], + "returnType" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + }, + { + "abiName" : "bjs_setTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTSTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_getTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTSTheme", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_createConverter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createConverter", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Utils.Converter" + } + } + }, + { + "abiName" : "bjs_useConverter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "useConverter", + "parameters" : [ + { + "label" : "converter", + "name" : "converter", + "type" : { + "swiftHeapObject" : { + "_0" : "Utils.Converter" + } + } + }, + { + "label" : "value", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_roundTripConverterArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripConverterArray", + "parameters" : [ + { + "label" : "_", + "name" : "converters", + "type" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Utils.Converter" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Utils.Converter" + } + } + } + } + }, + { + "abiName" : "bjs_createHTTPServer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createHTTPServer", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Networking.API.HTTPServer" + } + } + }, + { + "abiName" : "bjs_createUUID", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createUUID", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "UUID" + } + } + }, + { + "abiName" : "bjs_roundTripUUID", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripUUID", + "parameters" : [ + { + "label" : "_", + "name" : "uuid", + "type" : { + "swiftHeapObject" : { + "_0" : "UUID" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "UUID" + } + } + }, + { + "abiName" : "bjs_roundtripNetworkingAPIMethod", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripNetworkingAPIMethod", + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + }, + { + "abiName" : "bjs_roundtripConfigurationLogLevel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripConfigurationLogLevel", + "parameters" : [ + { + "label" : "_", + "name" : "level", + "type" : { + "rawValueEnum" : { + "_0" : "Configuration.LogLevel", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Configuration.LogLevel", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_roundtripConfigurationPort", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripConfigurationPort", + "parameters" : [ + { + "label" : "_", + "name" : "port", + "type" : { + "rawValueEnum" : { + "_0" : "Configuration.Port", + "_1" : "Int" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Configuration.Port", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_processConfigurationLogLevel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processConfigurationLogLevel", + "parameters" : [ + { + "label" : "_", + "name" : "level", + "type" : { + "rawValueEnum" : { + "_0" : "Configuration.LogLevel", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Configuration.Port", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_roundtripInternalSupportedMethod", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripInternalSupportedMethod", + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Internal.SupportedMethod" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Internal.SupportedMethod" + } + } + }, + { + "abiName" : "bjs_roundtripAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAPIResult", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultSuccess", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultFailure", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultFailure", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultInfo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultInfo", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultFlag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultFlag", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultRate", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultRate", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "float" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultPrecise", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultPrecise", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_roundtripComplexResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripComplexResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultSuccess", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultError", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultError", + "parameters" : [ + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultLocation", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultLocation", + "parameters" : [ + { + "label" : "_", + "name" : "lat", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "lng", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultStatus", + "parameters" : [ + { + "label" : "_", + "name" : "active", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultCoordinates", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultCoordinates", + "parameters" : [ + { + "label" : "_", + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "y", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "z", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultComprehensive", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultComprehensive", + "parameters" : [ + { + "label" : "_", + "name" : "flag1", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "flag2", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "count1", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "_", + "name" : "count2", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "_", + "name" : "value1", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "value2", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "text1", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "text2", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "text3", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultInfo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultInfo", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeUtilitiesResultSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeUtilitiesResultSuccess", + "parameters" : [ + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + }, + { + "abiName" : "bjs_makeUtilitiesResultFailure", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeUtilitiesResultFailure", + "parameters" : [ + { + "label" : "_", + "name" : "error", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + }, + { + "abiName" : "bjs_makeUtilitiesResultStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeUtilitiesResultStatus", + "parameters" : [ + { + "label" : "_", + "name" : "active", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + }, + { + "abiName" : "bjs_makeAPINetworkingResultSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPINetworkingResultSuccess", + "parameters" : [ + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" + } + } + }, + { + "abiName" : "bjs_makeAPINetworkingResultFailure", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPINetworkingResultFailure", + "parameters" : [ + { + "label" : "_", + "name" : "error", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" + } + } + }, + { + "abiName" : "bjs_roundtripUtilitiesResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripUtilitiesResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + }, + { + "abiName" : "bjs_roundtripAPINetworkingResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAPINetworkingResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" + } + } + }, + { + "abiName" : "bjs_roundTripAllTypesResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripAllTypesResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "AllTypesResult" + } + } + }, + { + "abiName" : "bjs_roundTripTypedPayloadResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripTypedPayloadResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "TypedPayloadResult" + } + } + }, + { + "abiName" : "bjs_createPropertyHolder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createPropertyHolder", + "parameters" : [ + { + "label" : "intValue", + "name" : "intValue", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "floatValue", + "name" : "floatValue", + "type" : { + "float" : { + + } + } + }, + { + "label" : "doubleValue", + "name" : "doubleValue", + "type" : { + "double" : { + + } + } + }, + { + "label" : "boolValue", + "name" : "boolValue", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "stringValue", + "name" : "stringValue", + "type" : { + "string" : { + + } + } + }, + { + "label" : "jsObject", + "name" : "jsObject", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "PropertyHolder" + } + } + }, + { + "abiName" : "bjs_testPropertyHolder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testPropertyHolder", + "parameters" : [ + { + "label" : "holder", + "name" : "holder", + "type" : { + "swiftHeapObject" : { + "_0" : "PropertyHolder" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_resetObserverCounts", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetObserverCounts", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getObserverStats", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getObserverStats", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_formatName", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "formatName", + "parameters" : [ + { + "label" : "_", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "label" : "transform", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_makeFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFormatter", + "parameters" : [ + { + "label" : "prefix", + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_makeAdder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAdder", + "parameters" : [ + { + "label" : "base", + "name" : "base", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "abiName" : "bjs_getSharedSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getSharedSubject", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "IdentityTestSubject" + } + } + }, + { + "abiName" : "bjs_resetSharedSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetSharedSubject", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getRetainLeakSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getRetainLeakSubject", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "RetainLeakSubject" + } + } + }, + { + "abiName" : "bjs_resetRetainLeakSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetRetainLeakSubject", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getRetainLeakDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getRetainLeakDeinits", + "parameters" : [ + + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_resetRetainLeakDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetRetainLeakDeinits", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_setupArrayPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setupArrayPool", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getArrayPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getArrayPool", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "ArrayIdentityElement" + } + } + } + } + }, + { + "abiName" : "bjs_getArrayPoolElement", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getArrayPoolElement", + "parameters" : [ + { + "label" : "_", + "name" : "index", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "ArrayIdentityElement" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_getArrayPoolDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getArrayPoolDeinits", + "parameters" : [ + + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_resetArrayPoolDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetArrayPoolDeinits", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_clearArrayPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "clearArrayPool", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_roundTripPointerFields", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripPointerFields", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "PointerFields" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "PointerFields" + } + } + }, + { + "abiName" : "bjs_testStructDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testStructDefault", + "parameters" : [ + { + "defaultValue" : { + "structLiteral" : { + "_0" : "DataPoint", + "_1" : [ + { + "name" : "x", + "value" : { + "float" : { + "_0" : 1 + } + } + }, + { + "name" : "y", + "value" : { + "float" : { + "_0" : 2 + } + } + }, + { + "name" : "label", + "value" : { + "string" : { + "_0" : "default" + } + } + }, + { + "name" : "optCount", + "value" : { + "null" : { + + } + } + }, + { + "name" : "optFlag", + "value" : { + "null" : { + + } + } + } + ] + } + }, + "label" : "point", + "name" : "point", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_cartToJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "cartToJSObject", + "parameters" : [ + { + "label" : "_", + "name" : "cart", + "type" : { + "swiftStruct" : { + "_0" : "CopyableCart" + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_nestedCartToJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "nestedCartToJSObject", + "parameters" : [ + { + "label" : "_", + "name" : "cart", + "type" : { + "swiftStruct" : { + "_0" : "CopyableNestedCart" + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_roundTripDataPoint", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDataPoint", + "parameters" : [ + { + "label" : "_", + "name" : "data", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "abiName" : "bjs_roundTripPublicPoint", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripPublicPoint", + "parameters" : [ + { + "label" : "_", + "name" : "point", + "type" : { + "swiftStruct" : { + "_0" : "PublicPoint" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "PublicPoint" + } + } + }, + { + "abiName" : "bjs_roundTripContact", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripContact", + "parameters" : [ + { + "label" : "_", + "name" : "contact", + "type" : { + "swiftStruct" : { + "_0" : "Contact" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Contact" + } + } + }, + { + "abiName" : "bjs_roundTripConfig", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripConfig", + "parameters" : [ + { + "label" : "_", + "name" : "config", + "type" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Config" + } + } + }, + { + "abiName" : "bjs_roundTripSessionData", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripSessionData", + "parameters" : [ + { + "label" : "_", + "name" : "session", + "type" : { + "swiftStruct" : { + "_0" : "SessionData" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "SessionData" + } + } + }, + { + "abiName" : "bjs_roundTripValidationReport", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripValidationReport", + "parameters" : [ + { + "label" : "_", + "name" : "report", + "type" : { + "swiftStruct" : { + "_0" : "ValidationReport" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ValidationReport" + } + } + }, + { + "abiName" : "bjs_roundTripAdvancedConfig", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripAdvancedConfig", + "parameters" : [ + { + "label" : "_", + "name" : "config", + "type" : { + "swiftStruct" : { + "_0" : "AdvancedConfig" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "AdvancedConfig" + } + } + }, + { + "abiName" : "bjs_roundTripMeasurementConfig", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripMeasurementConfig", + "parameters" : [ + { + "label" : "_", + "name" : "config", + "type" : { + "swiftStruct" : { + "_0" : "MeasurementConfig" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "MeasurementConfig" + } + } + }, + { + "abiName" : "bjs_updateValidationReport", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateValidationReport", + "parameters" : [ + { + "label" : "_", + "name" : "newResult", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + { + "label" : "_", + "name" : "report", + "type" : { + "swiftStruct" : { + "_0" : "ValidationReport" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ValidationReport" + } + } + }, + { + "abiName" : "bjs_testContainerWithStruct", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testContainerWithStruct", + "parameters" : [ + { + "label" : "_", + "name" : "point", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Container" + } + } + }, + { + "abiName" : "bjs_roundTripJSObjectContainer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripJSObjectContainer", + "parameters" : [ + { + "label" : "_", + "name" : "container", + "type" : { + "swiftStruct" : { + "_0" : "JSObjectContainer" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "JSObjectContainer" + } + } + }, + { + "abiName" : "bjs_roundTripFooContainer", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripFooContainer", + "parameters" : [ + { + "label" : "_", + "name" : "container", + "type" : { + "swiftStruct" : { + "_0" : "FooContainer" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "FooContainer" + } + } + }, + { + "abiName" : "bjs_roundTripArrayMembers", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripArrayMembers", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "ArrayMembers" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ArrayMembers" + } + } + }, + { + "abiName" : "bjs_arrayMembersSum", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "arrayMembersSum", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "ArrayMembers" + } + } + }, + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_arrayMembersFirst", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "arrayMembersFirst", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "ArrayMembers" + } + } + }, + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "protocols" : [ + { + "methods" : [ + + ], + "name" : "ArrayElementProtocol", + "properties" : [ + { + "isReadonly" : false, + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + { + "methods" : [ + { + "abiName" : "bjs_DataProcessor_increment", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "increment", + "parameters" : [ + { + "label" : "by", + "name" : "amount", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_getValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getValue", + "parameters" : [ + + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_DataProcessor_setLabelElements", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setLabelElements", + "parameters" : [ + { + "label" : "_", + "name" : "labelPrefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "labelSuffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_getLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getLabel", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_isEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_processGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_createGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createGreeter", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_DataProcessor_processOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_createOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalGreeter", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_DataProcessor_handleAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_getAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAPIResult", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "DataProcessor", + "properties" : [ + { + "isReadonly" : false, + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "name" : "optionalTag", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "name" : "optionalCount", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "name" : "direction", + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "name" : "optionalTheme", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "name" : "httpStatus", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "name" : "apiResult", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : false, + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "isReadonly" : false, + "name" : "optionalHelper", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ] + } + ], + "structs" : [ + { + "methods" : [ + + ], + "name" : "Point", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "Point" + }, + { + "constructor" : { + "abiName" : "bjs_PointerFields_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "raw", + "name" : "raw", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + }, + { + "label" : "mutRaw", + "name" : "mutRaw", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + }, + { + "label" : "opaque", + "name" : "opaque", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + }, + { + "label" : "ptr", + "name" : "ptr", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + }, + { + "label" : "mutPtr", + "name" : "mutPtr", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "PointerFields", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "raw", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeRawPointer" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "mutRaw", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutableRawPointer" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "opaque", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "opaquePointer" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "ptr", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafePointer", + "pointee" : "UInt8" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "mutPtr", + "type" : { + "unsafePointer" : { + "_0" : { + "kind" : "unsafeMutablePointer", + "pointee" : "UInt8" + } + } + } + } + ], + "swiftCallName" : "PointerFields" + }, + { + "constructor" : { + "abiName" : "bjs_DataPoint_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "x", + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "double" : { + + } + } + }, + { + "label" : "label", + "name" : "label", + "type" : { + "string" : { + + } + } + }, + { + "label" : "optCount", + "name" : "optCount", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "label" : "optFlag", + "name" : "optFlag", + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_DataPoint_static_origin", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "origin", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "staticContext" : { + "structName" : { + "_0" : "DataPoint" + } + } + } + ], + "name" : "DataPoint", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "label", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optCount", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optFlag", + "type" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "dimensions", + "staticContext" : { + "structName" : { + "_0" : "DataPoint" + } + }, + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "DataPoint" + }, + { + "constructor" : { + "abiName" : "bjs_PublicPoint_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "x", + "name" : "x", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "explicitAccessControl" : "public", + "methods" : [ + + ], + "name" : "PublicPoint", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "PublicPoint" + }, + { + "methods" : [ + + ], + "name" : "Address", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "street", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "city", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "zipCode", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "Address" + }, + { + "methods" : [ + + ], + "name" : "Contact", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "age", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "address", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "email", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "secondaryAddress", + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Address" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "Contact" + }, + { + "methods" : [ + + ], + "name" : "Config", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "theme", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "direction", + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + ], + "swiftCallName" : "Config" + }, + { + "methods" : [ + + ], + "name" : "SessionData", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "owner", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "SessionData" + }, + { + "methods" : [ + + ], + "name" : "ValidationReport", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "status", + "type" : { + "nullable" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "outcome", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "ValidationReport" + }, + { + "methods" : [ + + ], + "name" : "AdvancedConfig", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "title", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "enabled", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "result", + "type" : { + "nullable" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "metadata", + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "location", + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "defaults", + "type" : { + "swiftStruct" : { + "_0" : "ConfigStruct" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "overrideDefaults", + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "ConfigStruct" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "AdvancedConfig" + }, + { + "methods" : [ + + ], + "name" : "MeasurementConfig", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "precision", + "type" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "ratio", + "type" : { + "rawValueEnum" : { + "_0" : "Ratio", + "_1" : "Double" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalPrecision", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Precision", + "_1" : "Float" + } + }, + "_1" : "null" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalRatio", + "type" : { + "nullable" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Ratio", + "_1" : "Double" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "MeasurementConfig" + }, + { + "constructor" : { + "abiName" : "bjs_MathOperations_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "defaultValue" : { + "double" : { + "_0" : 0 + } + }, + "label" : "baseValue", + "name" : "baseValue", + "type" : { + "double" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_MathOperations_add", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "double" : { + + } + } + }, + { + "defaultValue" : { + "double" : { + "_0" : 10 + } + }, + "label" : "b", + "name" : "b", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_MathOperations_multiply", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "multiply", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "double" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_MathOperations_static_subtract", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "subtract", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "double" : { + + } + } + }, + { + "defaultValue" : { + "double" : { + "_0" : 5 + } + }, + "label" : "b", + "name" : "b", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + }, + "staticContext" : { + "structName" : { + "_0" : "MathOperations" + } + } + } + ], + "name" : "MathOperations", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "baseValue", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "MathOperations" + }, + { + "methods" : [ + { + "abiName" : "bjs_CopyableCart_static_fromJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "fromJSObject", + "parameters" : [ + { + "label" : "_", + "name" : "object", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "CopyableCart" + } + }, + "staticContext" : { + "structName" : { + "_0" : "CopyableCart" + } + } + } + ], + "name" : "CopyableCart", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "note", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "CopyableCart" + }, + { + "methods" : [ + + ], + "name" : "CopyableCartItem", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "sku", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "quantity", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "CopyableCartItem" + }, + { + "methods" : [ + { + "abiName" : "bjs_CopyableNestedCart_static_fromJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "fromJSObject", + "parameters" : [ + { + "label" : "_", + "name" : "object", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "CopyableNestedCart" + } + }, + "staticContext" : { + "structName" : { + "_0" : "CopyableNestedCart" + } + } + } + ], + "name" : "CopyableNestedCart", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "item", + "type" : { + "swiftStruct" : { + "_0" : "CopyableCartItem" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "shippingAddress", + "type" : { + "nullable" : { + "_0" : { + "swiftStruct" : { + "_0" : "Address" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "CopyableNestedCart" + }, + { + "methods" : [ + + ], + "name" : "ConfigStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "defaultConfig", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "maxRetries", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "timeout", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "computedSetting", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "ConfigStruct" + }, + { + "constructor" : { + "abiName" : "bjs_Vector2D_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "dx", + "name" : "dx", + "type" : { + "double" : { + + } + } + }, + { + "label" : "dy", + "name" : "dy", + "type" : { + "double" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_Vector2D_magnitude", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "magnitude", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_Vector2D_scaled", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "scaled", + "parameters" : [ + { + "label" : "by", + "name" : "factor", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Vector2D" + } + } + } + ], + "name" : "Vector2D", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "dx", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "dy", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "Vector2D" + }, + { + "methods" : [ + + ], + "name" : "JSObjectContainer", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "object", + "type" : { + "jsObject" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalObject", + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "JSObjectContainer" + }, + { + "methods" : [ + + ], + "name" : "FooContainer", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "foo", + "type" : { + "jsObject" : { + "_0" : "Foo" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optionalFoo", + "type" : { + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "Foo" + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "FooContainer" + }, + { + "methods" : [ + { + "abiName" : "bjs_ArrayMembers_sumValues", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "sumValues", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "abiName" : "bjs_ArrayMembers_firstString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "firstString", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "name" : "ArrayMembers", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "ints", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optStrings", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "swiftCallName" : "ArrayMembers" + } + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "id", + "type" : { + "string" : { + + } + } + } + ] + }, + "getters" : [ + { + "name" : "id", + "type" : { + "string" : { + + } + } + } + ], + "methods" : [ + + ], + "name" : "ArrayElementObject", + "setters" : [ + + ], + "staticMethods" : [ + + ] + }, + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "ArraySupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsIntArrayLength", + "parameters" : [ + { + "name" : "items", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripIntArray", + "parameters" : [ + { + "name" : "items", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripNumberArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripStringArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripBoolArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripJSValueArray", + "parameters" : [ + { + "name" : "v", + "type" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripJSObjectArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsObject" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripJSClassArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "jsObject" : { + "_0" : "ArrayElementObject" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "jsObject" : { + "_0" : "ArrayElementObject" + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalIntArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalStringArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalBoolArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "bool" : { + + } + }, + "_1" : "null" + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalJSValueArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsValue" : { + + } + }, + "_1" : "null" + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalJSObjectArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsObject" : { + + } + }, + "_1" : "null" + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalJSClassArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "ArrayElementObject" + } + }, + "_1" : "null" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "nullable" : { + "_0" : { + "jsObject" : { + "_0" : "ArrayElementObject" + } + }, + "_1" : "null" + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsSumNumberArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsCreateNumberArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "runJsArraySupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "AsyncImportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripNumber", + "parameters" : [ + { + "name" : "v", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripBool", + "parameters" : [ + { + "name" : "v", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripString", + "parameters" : [ + { + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripOptionalString", + "parameters" : [ + { + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripOptionalNumber", + "parameters" : [ + { + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "double" : { + + } + }, + "_1" : "null" + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripBoolArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripIntArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripStringArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsAsyncRoundTripFeatureFlag", + "parameters" : [ + { + "name" : "v", + "type" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + } + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "ClosureSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsApplyVoid", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_y", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsApplyBool", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_Sb", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsApplyInt", + "parameters" : [ + { + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsApplyDouble", + "parameters" : [ + { + "name" : "value", + "type" : { + "double" : { + + } + } + }, + { + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "double" : { + + } + } + ], + "returnType" : { + "double" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsApplyString", + "parameters" : [ + { + "name" : "value", + "type" : { + "string" : { + + } + } + }, + { + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsApplyJSObject", + "parameters" : [ + { + "name" : "value", + "type" : { + "jsObject" : { + + } + } + }, + { + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests8JSObjectC_8JSObjectC", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "jsObject" : { + + } + } + ], + "returnType" : { + "jsObject" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsMakeIntToInt", + "parameters" : [ + { + "name" : "base", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsMakeDoubleToDouble", + "parameters" : [ + { + "name" : "base", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "double" : { + + } + } + ], + "returnType" : { + "double" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsMakeStringToString", + "parameters" : [ + { + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : false + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsCallTwice", + "parameters" : [ + { + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_y", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + ], + "returnType" : { + "void" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsCallBinary", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSiSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsCallTriple", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSiSiSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsCallAfterRelease", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_y", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsOptionalInvoke", + "parameters" : [ + { + "name" : "callback", + "type" : { + "nullable" : { + "_0" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_Sb", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsStoreClosure", + "parameters" : [ + { + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_y", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + }, + "sendingParameters" : false + }, + "useJSTypedClosure" : true + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsCallStoredClosure", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsHeapCount", + "parameters" : [ + + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "runJsClosureSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "DefaultArgumentImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "runJsDefaultArgumentTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "DictionarySupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripDictionaryInt", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripDictionaryBool", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripDictionaryDouble", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripDictionaryJSObject", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "jsObject" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "jsObject" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripDictionaryJSValue", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "jsValue" : { + + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "jsValue" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripDictionaryDoubleArray", + "parameters" : [ + { + "name" : "values", + "type" : { + "dictionary" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + } + } + ], + "returnType" : { + "dictionary" : { + "_0" : { + "array" : { + "_0" : { + "double" : { + + } + } + } + } + } + } + } + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "value", + "type" : { + "string" : { + + } + } + } + ] + }, + "getters" : [ + { + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "methods" : [ + + ], + "name" : "Foo", + "setters" : [ + + ], + "staticMethods" : [ + + ] + } + ] + }, + { + "functions" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripNumber", + "parameters" : [ + { + "name" : "v", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripBool", + "parameters" : [ + { + "name" : "v", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripString", + "parameters" : [ + { + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripJSValue", + "parameters" : [ + { + "name" : "v", + "type" : { + "jsValue" : { + + } + } + } + ], + "returnType" : { + "jsValue" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsThrowOrVoid", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsThrowOrNumber", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsThrowOrBool", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsThrowOrString", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripFeatureFlag", + "parameters" : [ + { + "name" : "flag", + "type" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "FeatureFlag", + "_1" : "String" + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "runAsyncWorks", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : true + }, + "name" : "fetchWeatherData", + "parameters" : [ + { + "name" : "city", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + "_0" : "WeatherData" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "jsName" : "$jsWeirdFunction", + "name" : "_jsWeirdFunction", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "from" : "global", + "name" : "parseInt", + "parameters" : [ + { + "name" : "string", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + } + ], + "globalGetters" : [ + { + "from" : "global", + "name" : "globalObject1", + "type" : { + "jsValue" : { + + } + } + } + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ] + }, + "getters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "methods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "changeName", + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "JsGreeter", + "setters" : [ + { + "functionName" : "name_set", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "staticMethods" : [ + + ] + }, + { + "getters" : [ + { + "name" : "temperature", + "type" : { + "double" : { + + } + } + }, + { + "name" : "description", + "type" : { + "string" : { + + } + } + }, + { + "name" : "humidity", + "type" : { + "double" : { + + } + } + } + ], + "methods" : [ + + ], + "name" : "WeatherData", + "setters" : [ + { + "functionName" : "temperature_set", + "name" : "temperature", + "type" : { + "double" : { + + } + } + }, + { + "functionName" : "description_set", + "name" : "description", + "type" : { + "string" : { + + } + } + }, + { + "functionName" : "humidity_set", + "name" : "humidity", + "type" : { + "double" : { + + } + } + } + ], + "staticMethods" : [ + + ] + }, + { + "constructor" : { + "parameters" : [ + + ] + }, + "getters" : [ + + ], + "jsName" : "$WeirdClass", + "methods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "jsName" : "method-with-dashes", + "name" : "method_with_dashes", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "_WeirdClass", + "setters" : [ + + ], + "staticMethods" : [ + + ] + }, + { + "constructor" : { + "parameters" : [ + { + "name" : "value", + "type" : { + "double" : { + + } + } + } + ] + }, + "getters" : [ + + ], + "methods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "value", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + } + ], + "name" : "StaticBox", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "create", + "parameters" : [ + { + "name" : "value", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "value", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "makeDefault", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "jsName" : "with-dashes", + "name" : "with_dashes", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "StaticBox" + } + } + } + ] + }, + { + "constructor" : { + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "age", + "type" : { + "double" : { + + } + } + }, + { + "name" : "isCat", + "type" : { + "bool" : { + + } + } + } + ] + }, + "from" : "global", + "getters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "age", + "type" : { + "double" : { + + } + } + }, + { + "name" : "isCat", + "type" : { + "bool" : { + + } + } + } + ], + "methods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "bark", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "getIsCat", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + } + ], + "name" : "Animal", + "setters" : [ + { + "functionName" : "name_set", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "functionName" : "age_set", + "name" : "age", + "type" : { + "double" : { + + } + } + }, + { + "functionName" : "isCat_set", + "name" : "isCat", + "type" : { + "bool" : { + + } + } + } + ], + "staticMethods" : [ + + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "IdentityModeSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "runJsIdentityModeSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ] + } + ] + }, + { + "functions" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsTranslatePoint", + "parameters" : [ + { + "name" : "point", + "type" : { + "swiftStruct" : { + "_0" : "Point" + } + } + }, + { + "name" : "dx", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "name" : "dy", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Point" + } + } + } + ], + "types" : [ + + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "IntegerTypesSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripInt", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripUInt", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "word" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripInt8", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w8" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripUInt8", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w8" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripInt16", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w16" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripUInt16", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w16" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripInt32", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w32" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripUInt32", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w32" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripInt64", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "w64" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripUInt64", + "parameters" : [ + { + "name" : "v", + "type" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : false, + "width" : "w64" + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "runJsIntegerTypesSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "numbers", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "name" : "labels", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ] + }, + "getters" : [ + { + "name" : "numbers", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "name" : "labels", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "methods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "concatNumbers", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "concatLabels", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "firstLabel", + "parameters" : [ + { + "name" : "values", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "JSClassWithArrayMembers", + "setters" : [ + { + "functionName" : "numbers_set", + "name" : "numbers", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "functionName" : "labels_set", + "name" : "labels", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "staticMethods" : [ + + ] + }, + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "JSClassSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "makeJSClassWithArrayMembers", + "parameters" : [ + { + "name" : "numbers", + "type" : { + "array" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + } + }, + { + "name" : "labels", + "type" : { + "array" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "jsObject" : { + "_0" : "JSClassWithArrayMembers" + } + } + } + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + + ] + }, + "from" : "global", + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "MyJSClassInternal", + "setters" : [ + + ], + "staticMethods" : [ + + ] + }, + { + "constructor" : { + "parameters" : [ + + ] + }, + "from" : "global", + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "MyJSClassPublic", + "setters" : [ + + ], + "staticMethods" : [ + + ] + }, + { + "constructor" : { + "parameters" : [ + + ] + }, + "from" : "global", + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "MyJSClassPackage", + "setters" : [ + + ], + "staticMethods" : [ + + ] + } + ] + }, + { + "functions" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsFunctionWithPackageAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsFunctionWithPublicAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsFunctionWithInternalAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsFunctionWithFilePrivateAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsFunctionWithPrivateAccess", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + }, + { + "functions" : [ + + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "OptionalSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalNumberNull", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "null" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalNumberUndefined", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + }, + "_1" : "undefined" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalStringNull", + "parameters" : [ + { + "name" : "name", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "null" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalStringUndefined", + "parameters" : [ + { + "name" : "name", + "type" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "string" : { + + } + }, + "_1" : "undefined" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalJSValueArrayNull", + "parameters" : [ + { + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "null" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalJSValueArrayUndefined", + "parameters" : [ + { + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "array" : { + "_0" : { + "jsValue" : { + + } + } + } + }, + "_1" : "undefined" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalStringToStringDictionaryNull", + "parameters" : [ + { + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "null" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalStringToStringDictionaryUndefined", + "parameters" : [ + { + "name" : "v", + "type" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "undefined" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "dictionary" : { + "_0" : { + "string" : { + + } + } + } + }, + "_1" : "undefined" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "runJsOptionalSupportTests", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ] + } + ] + }, + { + "functions" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "from" : "global", + "name" : "gc", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + + ], + "name" : "SwiftClassSupportImports", + "setters" : [ + + ], + "staticMethods" : [ + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripGreeter", + "parameters" : [ + { + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripUUID", + "parameters" : [ + { + "name" : "uuid", + "type" : { + "swiftHeapObject" : { + "_0" : "UUID" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "UUID" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsRoundTripOptionalGreeter", + "parameters" : [ + { + "name" : "greeter", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + }, + "_1" : "null" + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsConsumeLeakCheck", + "parameters" : [ + { + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "LeakCheck" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "jsConsumeOptionalLeakCheck", + "parameters" : [ + { + "name" : "value", + "type" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "LeakCheck" + } + }, + "_1" : "null" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ] + } + ] + } + ] + }, + "moduleName" : "BridgeJSRuntimeTests" +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/IdentityModeSupportTests.swift b/Tests/BridgeJSIdentityTests/IdentityModeTests.swift similarity index 87% rename from Tests/BridgeJSRuntimeTests/IdentityModeSupportTests.swift rename to Tests/BridgeJSIdentityTests/IdentityModeTests.swift index a7c41035e..795b0679b 100644 --- a/Tests/BridgeJSRuntimeTests/IdentityModeSupportTests.swift +++ b/Tests/BridgeJSIdentityTests/IdentityModeTests.swift @@ -1,13 +1,13 @@ import XCTest import JavaScriptKit -@JSClass struct IdentityModeSupportImports { - @JSFunction static func runJsIdentityModeSupportTests() throws(JSException) +@JSClass struct IdentityModeTestImports { + @JSFunction static func runJsIdentityModeTests() throws(JSException) } -final class IdentityModeSupportTests: XCTestCase { - func testRunJsIdentityModeSupportTests() throws { - try IdentityModeSupportImports.runJsIdentityModeSupportTests() +final class IdentityModeTests: XCTestCase { + func testRunJsIdentityModeTests() throws { + try IdentityModeTestImports.runJsIdentityModeTests() } } diff --git a/Tests/BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs b/Tests/BridgeJSIdentityTests/JavaScript/IdentityModeTests.mjs similarity index 58% rename from Tests/BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs rename to Tests/BridgeJSIdentityTests/JavaScript/IdentityModeTests.mjs index a17a9b1c7..b2ae2187d 100644 --- a/Tests/BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs +++ b/Tests/BridgeJSIdentityTests/JavaScript/IdentityModeTests.mjs @@ -3,11 +3,11 @@ import assert from "node:assert"; /** - * @returns {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Imports["IdentityModeSupportImports"]} + * @returns {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Imports["IdentityModeTestImports"]} */ export function getImports(importsContext) { return { - runJsIdentityModeSupportTests: () => { + runJsIdentityModeTests: () => { const exports = importsContext.getExports(); if (!exports) { throw new Error("No exports!?"); @@ -21,55 +21,38 @@ export function getImports(importsContext) { * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function runIdentityModeTests(exports) { - const identityMode = process.env.IDENTITY_MODE || undefined; - - testWrapperIdentity(exports, identityMode); - testCacheInvalidationOnRelease(exports, identityMode); + testWrapperIdentity(exports); + testCacheInvalidationOnRelease(exports); testDifferentClassesDontCollide(exports); - testRetainLeakOnCacheHit(exports, identityMode); - testArrayElementIdentity(exports, identityMode); - testArrayElementMatchesSingleGetter(exports, identityMode); - testArrayRetainLeak(exports, identityMode); + testRetainLeakOnCacheHit(exports); + testArrayElementIdentity(exports); + testArrayElementMatchesSingleGetter(exports); + testArrayRetainLeak(exports); } /** * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports - * @param {string | undefined} identityMode */ -function testWrapperIdentity(exports, identityMode) { +function testWrapperIdentity(exports) { exports.resetSharedSubject(); const a = exports.getSharedSubject(); const b = exports.getSharedSubject(); - if (identityMode === "pointer") { - assert.strictEqual( - a, - b, - "In pointer mode, same Swift object should return identical JS wrapper", - ); - } else { - assert.notStrictEqual( - a, - b, - "In default mode, same Swift object should return different JS wrappers", - ); - } - + assert.strictEqual( + a, + b, + "Same Swift object should return identical JS wrapper", + ); assert.equal(a.currentValue, 42); - assert.equal(b.currentValue, 42); a.release(); - if (a !== b) { - b.release(); - } exports.resetSharedSubject(); } /** * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports - * @param {string | undefined} identityMode */ -function testCacheInvalidationOnRelease(exports, identityMode) { +function testCacheInvalidationOnRelease(exports) { exports.resetSharedSubject(); const first = exports.getSharedSubject(); first.release(); @@ -90,16 +73,13 @@ function testCacheInvalidationOnRelease(exports, identityMode) { /** * Verifies that repeated boundary crossings of the same Swift object don't leak - * retain counts. In pointer mode, each cache hit triggers passRetained on the - * Swift side. Without the balancing deinit(pointer) call on cache hit, each - * crossing leaks +1 retain and the object is never deallocated. + * retain counts. Each cache hit triggers passRetained on the Swift side. Without + * the balancing deinit(pointer) call on cache hit, each crossing leaks +1 retain + * and the object is never deallocated. * * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports - * @param {string | undefined} identityMode */ -function testRetainLeakOnCacheHit(exports, identityMode) { - if (identityMode !== "pointer") return; - +function testRetainLeakOnCacheHit(exports) { exports.resetRetainLeakDeinits(); exports.resetRetainLeakSubject(); @@ -128,29 +108,23 @@ function testRetainLeakOnCacheHit(exports, identityMode) { } /** - * Verifies that elements at the same index across repeated array returns are === - * in pointer mode. Without pointer mode, they should be different wrappers. - * * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports - * @param {string | undefined} identityMode */ -function testArrayElementIdentity(exports, identityMode) { - if (identityMode !== "pointer") return; - +function testArrayElementIdentity(exports) { exports.setupArrayPool(10); const arr1 = exports.getArrayPool(); const arr2 = exports.getArrayPool(); - assert.equal(arr1.length, 10, "First array should have 10 elements"); - assert.equal(arr2.length, 10, "Second array should have 10 elements"); + assert.equal(arr1.length, 10); + assert.equal(arr2.length, 10); for (let i = 0; i < 10; i++) { assert.strictEqual( arr1[i], arr2[i], - `Array element at index ${i} should be === across calls in pointer mode`, + `Array element at index ${i} should be === across calls`, ); - assert.equal(arr1[i].tag, i, `Element ${i} should have correct tag`); + assert.equal(arr1[i].tag, i); } for (const elem of arr1) { @@ -160,15 +134,9 @@ function testArrayElementIdentity(exports, identityMode) { } /** - * Verifies that an array element is === to the same object returned via - * a single-element getter. - * * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports - * @param {string | undefined} identityMode */ -function testArrayElementMatchesSingleGetter(exports, identityMode) { - if (identityMode !== "pointer") return; - +function testArrayElementMatchesSingleGetter(exports) { exports.setupArrayPool(5); const arr = exports.getArrayPool(); const single = exports.getArrayPoolElement(2); @@ -176,7 +144,7 @@ function testArrayElementMatchesSingleGetter(exports, identityMode) { assert.strictEqual( arr[2], single, - "Array element and single getter should return the same wrapper in pointer mode", + "Array element and single getter should return the same wrapper", ); assert.equal(single.tag, 2); @@ -187,16 +155,9 @@ function testArrayElementMatchesSingleGetter(exports, identityMode) { } /** - * Verifies that returning an array of N objects M times doesn't leak retains. - * After releasing all wrappers and clearing the pool, all objects should be - * deallocated. - * * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports - * @param {string | undefined} identityMode */ -function testArrayRetainLeak(exports, identityMode) { - if (identityMode !== "pointer") return; - +function testArrayRetainLeak(exports) { exports.resetArrayPoolDeinits(); exports.setupArrayPool(5); @@ -223,17 +184,17 @@ function testArrayRetainLeak(exports, identityMode) { * @param {import('../../../.build/plugins/PackageToJS/outputs/PackageTests/bridge-js.d.ts').Exports} exports */ function testDifferentClassesDontCollide(exports) { - const greeter = new exports.Greeter("IdentityTest"); - const subject = new exports.IdentityTestSubject(99); + const subject1 = new exports.IdentityTestSubject(1); + const subject2 = new exports.IdentityTestSubject(2); assert.notStrictEqual( - greeter, - subject, - "Instances of different classes should never be ===", + subject1, + subject2, + "Different instances should not be ===", ); - assert.equal(greeter.name, "IdentityTest"); - assert.equal(subject.currentValue, 99); + assert.equal(subject1.currentValue, 1); + assert.equal(subject2.currentValue, 2); - greeter.release(); - subject.release(); + subject1.release(); + subject2.release(); } diff --git a/Tests/BridgeJSIdentityTests/bridge-js.config.json b/Tests/BridgeJSIdentityTests/bridge-js.config.json new file mode 100644 index 000000000..29884404e --- /dev/null +++ b/Tests/BridgeJSIdentityTests/bridge-js.config.json @@ -0,0 +1,3 @@ +{ + "identityMode": "pointer" +} diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index d28b05055..a37a7e4c5 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -7656,132 +7656,6 @@ public func _bjs_makeAdder(_ base: Int32) -> Int32 { #endif } -@_expose(wasm, "bjs_getSharedSubject") -@_cdecl("bjs_getSharedSubject") -public func _bjs_getSharedSubject() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = getSharedSubject() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_resetSharedSubject") -@_cdecl("bjs_resetSharedSubject") -public func _bjs_resetSharedSubject() -> Void { - #if arch(wasm32) - resetSharedSubject() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getRetainLeakSubject") -@_cdecl("bjs_getRetainLeakSubject") -public func _bjs_getRetainLeakSubject() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = getRetainLeakSubject() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_resetRetainLeakSubject") -@_cdecl("bjs_resetRetainLeakSubject") -public func _bjs_resetRetainLeakSubject() -> Void { - #if arch(wasm32) - resetRetainLeakSubject() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getRetainLeakDeinits") -@_cdecl("bjs_getRetainLeakDeinits") -public func _bjs_getRetainLeakDeinits() -> Int32 { - #if arch(wasm32) - let ret = getRetainLeakDeinits() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_resetRetainLeakDeinits") -@_cdecl("bjs_resetRetainLeakDeinits") -public func _bjs_resetRetainLeakDeinits() -> Void { - #if arch(wasm32) - resetRetainLeakDeinits() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_setupArrayPool") -@_cdecl("bjs_setupArrayPool") -public func _bjs_setupArrayPool(_ count: Int32) -> Void { - #if arch(wasm32) - setupArrayPool(_: Int.bridgeJSLiftParameter(count)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getArrayPool") -@_cdecl("bjs_getArrayPool") -public func _bjs_getArrayPool() -> Void { - #if arch(wasm32) - let ret = getArrayPool() - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getArrayPoolElement") -@_cdecl("bjs_getArrayPoolElement") -public func _bjs_getArrayPoolElement(_ index: Int32) -> Void { - #if arch(wasm32) - let ret = getArrayPoolElement(_: Int.bridgeJSLiftParameter(index)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getArrayPoolDeinits") -@_cdecl("bjs_getArrayPoolDeinits") -public func _bjs_getArrayPoolDeinits() -> Int32 { - #if arch(wasm32) - let ret = getArrayPoolDeinits() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_resetArrayPoolDeinits") -@_cdecl("bjs_resetArrayPoolDeinits") -public func _bjs_resetArrayPoolDeinits() -> Void { - #if arch(wasm32) - resetArrayPoolDeinits() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_clearArrayPool") -@_cdecl("bjs_clearArrayPool") -public func _bjs_clearArrayPool() -> Void { - #if arch(wasm32) - clearArrayPool() - #else - fatalError("Only available on WebAssembly") - #endif -} - @_expose(wasm, "bjs_roundTripPointerFields") @_cdecl("bjs_roundTripPointerFields") public func _bjs_roundTripPointerFields() -> Void { @@ -10598,206 +10472,6 @@ fileprivate func _bjs_TextProcessor_wrap_extern(_ pointer: UnsafeMutableRawPoint return _bjs_TextProcessor_wrap_extern(pointer) } -@_expose(wasm, "bjs_IdentityTestSubject_init") -@_cdecl("bjs_IdentityTestSubject_init") -public func _bjs_IdentityTestSubject_init(_ value: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = IdentityTestSubject(value: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IdentityTestSubject_value_get") -@_cdecl("bjs_IdentityTestSubject_value_get") -public func _bjs_IdentityTestSubject_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).value - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IdentityTestSubject_value_set") -@_cdecl("bjs_IdentityTestSubject_value_set") -public func _bjs_IdentityTestSubject_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - IdentityTestSubject.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IdentityTestSubject_currentValue_get") -@_cdecl("bjs_IdentityTestSubject_currentValue_get") -public func _bjs_IdentityTestSubject_currentValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).currentValue - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IdentityTestSubject_deinit") -@_cdecl("bjs_IdentityTestSubject_deinit") -public func _bjs_IdentityTestSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension IdentityTestSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IdentityTestSubject_wrap") -fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_IdentityTestSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_IdentityTestSubject_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_RetainLeakSubject_init") -@_cdecl("bjs_RetainLeakSubject_init") -public func _bjs_RetainLeakSubject_init(_ tag: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = RetainLeakSubject(tag: Int.bridgeJSLiftParameter(tag)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_RetainLeakSubject_tag_get") -@_cdecl("bjs_RetainLeakSubject_tag_get") -public func _bjs_RetainLeakSubject_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = RetainLeakSubject.bridgeJSLiftParameter(_self).tag - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_RetainLeakSubject_tag_set") -@_cdecl("bjs_RetainLeakSubject_tag_set") -public func _bjs_RetainLeakSubject_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - RetainLeakSubject.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_RetainLeakSubject_deinit") -@_cdecl("bjs_RetainLeakSubject_deinit") -public func _bjs_RetainLeakSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension RetainLeakSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_RetainLeakSubject_wrap") -fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_RetainLeakSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_RetainLeakSubject_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_ArrayIdentityElement_init") -@_cdecl("bjs_ArrayIdentityElement_init") -public func _bjs_ArrayIdentityElement_init(_ tag: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = ArrayIdentityElement(tag: Int.bridgeJSLiftParameter(tag)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArrayIdentityElement_tag_get") -@_cdecl("bjs_ArrayIdentityElement_tag_get") -public func _bjs_ArrayIdentityElement_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = ArrayIdentityElement.bridgeJSLiftParameter(_self).tag - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArrayIdentityElement_tag_set") -@_cdecl("bjs_ArrayIdentityElement_tag_set") -public func _bjs_ArrayIdentityElement_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - ArrayIdentityElement.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArrayIdentityElement_deinit") -@_cdecl("bjs_ArrayIdentityElement_deinit") -public func _bjs_ArrayIdentityElement_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension ArrayIdentityElement: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayIdentityElement_wrap") -fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_ArrayIdentityElement_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_ArrayIdentityElement_wrap_extern(pointer) -} - @_expose(wasm, "bjs_OptionalHolder_init") @_cdecl("bjs_OptionalHolder_init") public func _bjs_OptionalHolder_init(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { @@ -13271,25 +12945,6 @@ func _$Animal_getIsCat(_ self: JSObject) throws(JSException) -> Bool { return Bool.bridgeJSLiftReturn(ret) } -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static") -fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -> Void -#else -fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static() -> Void { - return bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -} - -func _$IdentityModeSupportImports_runJsIdentityModeSupportTests() throws(JSException) -> Void { - bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static() - if let error = _swift_js_take_exception() { - throw error - } -} - #if arch(wasm32) @_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsTranslatePoint") fileprivate func bjs_jsTranslatePoint_extern(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json index 76ed6dea0..dd4362fc1 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -4067,151 +4067,6 @@ ], "swiftCallName" : "TextProcessor" }, - { - "constructor" : { - "abiName" : "bjs_IdentityTestSubject_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "IdentityTestSubject", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "currentValue", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "IdentityTestSubject" - }, - { - "constructor" : { - "abiName" : "bjs_RetainLeakSubject_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "tag", - "name" : "tag", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "RetainLeakSubject", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "tag", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "RetainLeakSubject" - }, - { - "constructor" : { - "abiName" : "bjs_ArrayIdentityElement_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "tag", - "name" : "tag", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "ArrayIdentityElement", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "tag", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "ArrayIdentityElement" - }, { "constructor" : { "abiName" : "bjs_OptionalHolder_init", @@ -13943,247 +13798,6 @@ } } }, - { - "abiName" : "bjs_getSharedSubject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getSharedSubject", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "IdentityTestSubject" - } - } - }, - { - "abiName" : "bjs_resetSharedSubject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetSharedSubject", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getRetainLeakSubject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getRetainLeakSubject", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "RetainLeakSubject" - } - } - }, - { - "abiName" : "bjs_resetRetainLeakSubject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetRetainLeakSubject", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getRetainLeakDeinits", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getRetainLeakDeinits", - "parameters" : [ - - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_resetRetainLeakDeinits", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetRetainLeakDeinits", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_setupArrayPool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setupArrayPool", - "parameters" : [ - { - "label" : "_", - "name" : "count", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getArrayPool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getArrayPool", - "parameters" : [ - - ], - "returnType" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "ArrayIdentityElement" - } - } - } - } - }, - { - "abiName" : "bjs_getArrayPoolElement", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getArrayPoolElement", - "parameters" : [ - { - "label" : "_", - "name" : "index", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "ArrayIdentityElement" - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_getArrayPoolDeinits", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getArrayPoolDeinits", - "parameters" : [ - - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_resetArrayPoolDeinits", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetArrayPoolDeinits", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_clearArrayPool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "clearArrayPool", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, { "abiName" : "bjs_roundTripPointerFields", "effects" : { @@ -19560,43 +19174,6 @@ } ] }, - { - "functions" : [ - - ], - "types" : [ - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "IdentityModeSupportImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "runJsIdentityModeSupportTests", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ] - } - ] - }, { "functions" : [ { diff --git a/Tests/prelude.mjs b/Tests/prelude.mjs index a3a9048f7..79c0cc740 100644 --- a/Tests/prelude.mjs +++ b/Tests/prelude.mjs @@ -14,14 +14,13 @@ import { getImports as getDefaultArgumentImports } from './BridgeJSRuntimeTests/ import { getImports as getJSClassSupportImports, JSClassWithArrayMembers } from './BridgeJSRuntimeTests/JavaScript/JSClassSupportTests.mjs'; import { getImports as getIntegerTypesSupportImports } from './BridgeJSRuntimeTests/JavaScript/IntegerTypesSupportTests.mjs'; import { getImports as getAsyncImportImports, runAsyncWorksTests } from './BridgeJSRuntimeTests/JavaScript/AsyncImportTests.mjs'; -import { getImports as getIdentityModeSupportImports } from './BridgeJSRuntimeTests/JavaScript/IdentityModeSupportTests.mjs'; +import { getImports as getIdentityModeTestImports } from './BridgeJSIdentityTests/JavaScript/IdentityModeTests.mjs'; /** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */ export async function setupOptions(options, context) { Error.stackTraceLimit = 100; setupTestGlobals(globalThis); - const identityMode = process.env.IDENTITY_MODE || undefined; class StaticBox { constructor(value) { @@ -46,7 +45,6 @@ export async function setupOptions(options, context) { return { ...options, - ...(identityMode ? { instantiateOptions: { identityMode } } : {}), getImports: (importsContext) => { return { "jsRoundTripVoid": () => { @@ -159,7 +157,7 @@ export async function setupOptions(options, context) { DefaultArgumentImports: getDefaultArgumentImports(importsContext), JSClassSupportImports: getJSClassSupportImports(importsContext), IntegerTypesSupportImports: getIntegerTypesSupportImports(importsContext), - IdentityModeSupportImports: getIdentityModeSupportImports(importsContext), + IdentityModeTestImports: getIdentityModeTestImports(importsContext), }; }, addToCoreImports(importObject, importsContext) { From 3d1907da3817a85ca3a11cca559da93fab876548 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 17 Apr 2026 12:45:17 +0200 Subject: [PATCH 07/14] fix: Exclude identityMode from DefaultNodeSetupOptions spread in index.js TypeScript strict excess property check rejects identityMode in the spread into DefaultNodeSetupOptions. Destructure it out before spreading, since it's already handled separately via the instantiateOptions pass-through. --- Plugins/PackageToJS/Templates/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/PackageToJS/Templates/index.js b/Plugins/PackageToJS/Templates/index.js index d7636c115..1e0db0f53 100644 --- a/Plugins/PackageToJS/Templates/index.js +++ b/Plugins/PackageToJS/Templates/index.js @@ -9,9 +9,10 @@ import { defaultBrowserSetup /* #if USE_SHARED_MEMORY */, createDefaultWorkerFac /* #if TARGET_DEFAULT_PLATFORM_NODE */ /** @type {import('./index.d').init} */ async function initNode(_options) { + const { identityMode: _identityMode, ...rest } = _options || {}; /** @type {import('./platforms/node.d.ts').DefaultNodeSetupOptions} */ const options = { - ...(_options || {}), + ...rest, /* #if USE_SHARED_MEMORY */ spawnWorker: createDefaultWorkerFactoryForNode(), /* #endif */ From 5bf23cdfc96b65a19cef6eb96ba838f7942decf3 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 17 Apr 2026 13:48:41 +0200 Subject: [PATCH 08/14] fix: Regenerate BridgeJSIdentityTests with correct target and add to generate script The Generated files were incorrectly copied from BridgeJSRuntimeTests, containing types from the wrong module. Regenerate with BridgeJSTool for the BridgeJSIdentityTests target. Add target to bridge-js-generate.sh. Fix SwiftToSkeleton formatting. --- .../BridgeJSCore/SwiftToSkeleton.swift | 8 +- .../Generated/BridgeJS.swift | 14258 +---------- .../Generated/JavaScript/BridgeJS.json | 21012 +--------------- Utilities/bridge-js-generate.sh | 1 + 4 files changed, 488 insertions(+), 34791 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 369c75e72..404eef634 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -44,7 +44,13 @@ public final class SwiftToSkeleton { public func finalize() throws -> BridgeJSSkeleton { var perSourceErrors: [(inputFilePath: String, errors: [DiagnosticError])] = [] var importedFiles: [ImportedFileSkeleton] = [] - var exported = ExportedSkeleton(functions: [], classes: [], enums: [], exposeToGlobal: exposeToGlobal, identityMode: identityMode) + var exported = ExportedSkeleton( + functions: [], + classes: [], + enums: [], + exposeToGlobal: exposeToGlobal, + identityMode: identityMode + ) var exportCollectors: [ExportSwiftAPICollector] = [] for (sourceFile, inputFilePath) in sourceFiles { diff --git a/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift b/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift index 9a92a00b5..e25ebeb4c 100644 --- a/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift @@ -7,14196 +7,346 @@ @_spi(BridgeJS) import JavaScriptKit -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 { +@_expose(wasm, "bjs_getSharedSubject") +@_cdecl("bjs_getSharedSubject") +public func _bjs_getSharedSubject() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = getSharedSubject() + return ret.bridgeJSLowerReturn() + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ callback: Int32, _ param0: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(callback, param0) + #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +@_expose(wasm, "bjs_resetSharedSubject") +@_cdecl("bjs_resetSharedSubject") +public func _bjs_resetSharedSubject() -> Void { + #if arch(wasm32) + resetSharedSubject() + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si { - static func bridgeJSLift(_ callbackId: Int32) -> (HttpStatus) -> Int { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(callbackValue, param0Value) - return Int.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (HttpStatus) -> Int { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (HttpStatus) -> Int) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si, - body: body, - fileID: fileID, - line: line - ) - } + #endif } -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests10HttpStatusO_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { +@_expose(wasm, "bjs_getRetainLeakSubject") +@_cdecl("bjs_getRetainLeakSubject") +public func _bjs_getRetainLeakSubject() -> UnsafeMutableRawPointer { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(HttpStatus) -> Int>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(HttpStatus.bridgeJSLiftParameter(param0)) - return result.bridgeJSLowerReturn() + let ret = getRetainLeakSubject() + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(_ callback: Int32, _ param0: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(_ callback: Int32, _ param0: Int32) -> Int32 { +@_expose(wasm, "bjs_resetRetainLeakSubject") +@_cdecl("bjs_resetRetainLeakSubject") +public func _bjs_resetRetainLeakSubject() -> Void { + #if arch(wasm32) + resetRetainLeakSubject() + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP(_ callback: Int32, _ param0: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(callback, param0) + #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +@_expose(wasm, "bjs_getRetainLeakDeinits") +@_cdecl("bjs_getRetainLeakDeinits") +public func _bjs_getRetainLeakDeinits() -> Int32 { + #if arch(wasm32) + let ret = getRetainLeakDeinits() + return ret.bridgeJSLowerReturn() + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP { - static func bridgeJSLift(_ callbackId: Int32) -> (any DataProcessor) -> any DataProcessor { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0ObjectId = (param0 as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP(callbackValue, param0ObjectId) - return AnyDataProcessor.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (any DataProcessor) -> any DataProcessor { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (any DataProcessor) -> any DataProcessor) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP, - body: body, - fileID: fileID, - line: line - ) - } + #endif } -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { +@_expose(wasm, "bjs_resetRetainLeakDeinits") +@_cdecl("bjs_resetRetainLeakDeinits") +public func _bjs_resetRetainLeakDeinits() -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(any DataProcessor) -> any DataProcessor>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(AnyDataProcessor.bridgeJSLiftParameter(param0)) - return (result as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn() + resetRetainLeakDeinits() #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 { +@_expose(wasm, "bjs_setupArrayPool") +@_cdecl("bjs_setupArrayPool") +public func _bjs_setupArrayPool(_ count: Int32) -> Void { + #if arch(wasm32) + setupArrayPool(_: Int.bridgeJSLiftParameter(count)) + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS(_ callback: Int32, _ param0: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(callback, param0) + #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +@_expose(wasm, "bjs_getArrayPool") +@_cdecl("bjs_getArrayPool") +public func _bjs_getArrayPool() -> Void { + #if arch(wasm32) + let ret = getArrayPool() + ret.bridgeJSStackPush() + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTests13DataProcessorP_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (any DataProcessor) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0ObjectId = (param0 as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS(callbackValue, param0ObjectId) - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (any DataProcessor) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (any DataProcessor) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS, - body: body, - fileID: fileID, - line: line - ) - } + #endif } -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests13DataProcessorP_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { +@_expose(wasm, "bjs_getArrayPoolElement") +@_cdecl("bjs_getArrayPoolElement") +public func _bjs_getArrayPoolElement(_ index: Int32) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(any DataProcessor) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(AnyDataProcessor.bridgeJSLiftParameter(param0)) - return result.bridgeJSLowerReturn() + let ret = getArrayPoolElement(_: Int.bridgeJSLiftParameter(index)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { +@_expose(wasm, "bjs_getArrayPoolDeinits") +@_cdecl("bjs_getArrayPoolDeinits") +public func _bjs_getArrayPoolDeinits() -> Int32 { + #if arch(wasm32) + let ret = getArrayPoolDeinits() + return ret.bridgeJSLowerReturn() + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(callback, param0Bytes, param0Length) + #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +@_expose(wasm, "bjs_resetArrayPoolDeinits") +@_cdecl("bjs_resetArrayPoolDeinits") +public func _bjs_resetArrayPoolDeinits() -> Void { + #if arch(wasm32) + resetArrayPoolDeinits() + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let ret0 = param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(callbackValue, param0Bytes, param0Length) - return ret - } - let ret = ret0 - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Theme) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Theme) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS, - body: body, - fileID: fileID, - line: line - ) - } + #endif } -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { +@_expose(wasm, "bjs_clearArrayPool") +@_cdecl("bjs_clearArrayPool") +public func _bjs_clearArrayPool() -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Theme) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) - return result.bridgeJSLowerReturn() + clearArrayPool() #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { +@_expose(wasm, "bjs_IdentityTestSubject_init") +@_cdecl("bjs_IdentityTestSubject_init") +public func _bjs_IdentityTestSubject_init(_ value: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = IdentityTestSubject(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(callback, param0Bytes, param0Length) + #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +@_expose(wasm, "bjs_IdentityTestSubject_value_get") +@_cdecl("bjs_IdentityTestSubject_value_get") +public func _bjs_IdentityTestSubject_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).value + return ret.bridgeJSLowerReturn() + #else fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_Sb { - static func bridgeJSLift(_ callbackId: Int32) -> (Theme) -> Bool { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let ret0 = param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(callbackValue, param0Bytes, param0Length) - return ret - } - let ret = ret0 - return Bool.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } + #endif } -extension JSTypedClosure where Signature == (Theme) -> Bool { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Theme) -> Bool) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb, - body: body, - fileID: fileID, - line: line - ) - } +@_expose(wasm, "bjs_IdentityTestSubject_value_set") +@_cdecl("bjs_IdentityTestSubject_value_set") +public func _bjs_IdentityTestSubject_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + IdentityTestSubject.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif } -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests5ThemeO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { +@_expose(wasm, "bjs_IdentityTestSubject_currentValue_get") +@_cdecl("bjs_IdentityTestSubject_currentValue_get") +public func _bjs_IdentityTestSubject_currentValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Theme) -> Bool>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Theme.bridgeJSLiftParameter(param0Bytes, param0Length)) - return result.bridgeJSLowerReturn() + let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).currentValue + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 { +@_expose(wasm, "bjs_IdentityTestSubject_deinit") +@_cdecl("bjs_IdentityTestSubject_deinit") +public func _bjs_IdentityTestSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else fatalError("Only available on WebAssembly") + #endif } -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ callback: Int32, _ param0: UnsafeMutableRawPointer) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(callback, param0) + +extension IdentityTestSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque()) + } } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "BridgeJSIdentityTests", name: "bjs_IdentityTestSubject_wrap") +fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS_extern(boxPtr, file, line) +@inline(never) fileprivate func _bjs_IdentityTestSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_IdentityTestSubject_wrap_extern(pointer) } -private enum _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Greeter) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Pointer = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(callbackValue, param0Pointer) - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } +@_expose(wasm, "bjs_RetainLeakSubject_init") +@_cdecl("bjs_RetainLeakSubject_init") +public func _bjs_RetainLeakSubject_init(_ tag: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = RetainLeakSubject(tag: Int.bridgeJSLiftParameter(tag)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif } -extension JSTypedClosure where Signature == (Greeter) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Greeter) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS, - body: body, - fileID: fileID, - line: line - ) - } +@_expose(wasm, "bjs_RetainLeakSubject_tag_get") +@_cdecl("bjs_RetainLeakSubject_tag_get") +public func _bjs_RetainLeakSubject_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = RetainLeakSubject.bridgeJSLiftParameter(_self).tag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif } -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: UnsafeMutableRawPointer) -> Void { +@_expose(wasm, "bjs_RetainLeakSubject_tag_set") +@_cdecl("bjs_RetainLeakSubject_tag_set") +public func _bjs_RetainLeakSubject_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Greeter) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Greeter.bridgeJSLiftParameter(param0)) - return result.bridgeJSLowerReturn() + RetainLeakSubject.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(_ callback: Int32, _ param0: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(_ callback: Int32, _ param0: Int32) -> Int32 { +@_expose(wasm, "bjs_RetainLeakSubject_deinit") +@_cdecl("bjs_RetainLeakSubject_deinit") +public func _bjs_RetainLeakSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else fatalError("Only available on WebAssembly") + #endif } -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ callback: Int32, _ param0: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(callback, param0) + +extension RetainLeakSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque()) + } } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "BridgeJSIdentityTests", name: "bjs_RetainLeakSubject_wrap") +fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC { - static func bridgeJSLift(_ callbackId: Int32) -> (JSObject) -> JSObject { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(callbackValue, param0Value) - return JSObject.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (JSObject) -> JSObject { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (JSObject) -> JSObject) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC, - body: body, - fileID: fileID, - line: line - ) - } +@inline(never) fileprivate func _bjs_RetainLeakSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_RetainLeakSubject_wrap_extern(pointer) } -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests8JSObjectC_8JSObjectC(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { +@_expose(wasm, "bjs_ArrayIdentityElement_init") +@_cdecl("bjs_ArrayIdentityElement_init") +public func _bjs_ArrayIdentityElement_init(_ tag: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(JSObject) -> JSObject>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(JSObject.bridgeJSLiftParameter(param0)) - return result.bridgeJSLowerReturn() + let ret = ArrayIdentityElement(tag: Int.bridgeJSLiftParameter(tag)) + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(callback, param0) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (APIResult) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0CaseId = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(callbackValue, param0CaseId) - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (APIResult) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (APIResult) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(APIResult) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(APIResult.bridgeJSLiftParameter(param0)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(_ callback: Int32, _ param0: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ callback: Int32, _ param0: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(callback, param0) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(callbackValue, param0Value) - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Direction) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Direction) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Direction) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Direction.bridgeJSLiftParameter(param0)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(_ callback: Int32, _ param0: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(_ callback: Int32, _ param0: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ callback: Int32, _ param0: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(callback, param0) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_Sb { - static func bridgeJSLift(_ callbackId: Int32) -> (Direction) -> Bool { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(callbackValue, param0Value) - return Bool.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Direction) -> Bool { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Direction) -> Bool) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTests9DirectionO_Sb(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Direction) -> Bool>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Direction.bridgeJSLiftParameter(param0)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> UnsafeMutableRawPointer -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> UnsafeMutableRawPointer { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(callback, param0Bytes, param0Length) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_7GreeterC { - static func bridgeJSLift(_ callbackId: Int32) -> (String) -> Greeter { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let ret0 = param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(callbackValue, param0Bytes, param0Length) - return ret - } - let ret = ret0 - return Greeter.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (String) -> Greeter { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (String) -> Greeter) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(String) -> Greeter>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(callback, param0Bytes, param0Length) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSS_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (String) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let ret0 = param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(callbackValue, param0Bytes, param0Length) - return ret - } - let ret = ret0 - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (String) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (String) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(String) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(_ callback: Int32, _ param0: Float64) -> Float64 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(_ callback: Int32, _ param0: Float64) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ callback: Int32, _ param0: Float64) -> Float64 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(callback, param0) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSd_Sd { - static func bridgeJSLift(_ callbackId: Int32) -> (Double) -> Double { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(callbackValue, param0Value) - return Double.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Double) -> Double { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Double) -> Double) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSd_Sd(_ boxPtr: UnsafeMutableRawPointer, _ param0: Float64) -> Float64 { +@_expose(wasm, "bjs_ArrayIdentityElement_tag_get") +@_cdecl("bjs_ArrayIdentityElement_tag_get") +public func _bjs_ArrayIdentityElement_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Double) -> Double>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Double.bridgeJSLiftParameter(param0)) - return result.bridgeJSLowerReturn() + let ret = ArrayIdentityElement.bridgeJSLiftParameter(_self).tag + return ret.bridgeJSLowerReturn() #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ callback: Int32, _ param0: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2: Float64) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ callback: Int32, _ param0: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2: Float64) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ callback: Int32, _ param0: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2: Float64) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(callback, param0, param1Bytes, param1Length, param2) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSSSd_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Int, String, Double) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] (param0, param1, param2) in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - let ret0 = param1.bridgeJSWithLoweredParameter { (param1Bytes, param1Length) in - let param2Value = param2.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(callbackValue, param0Value, param1Bytes, param1Length, param2Value) - return ret - } - let ret = ret0 - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Int, String, Double) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int, String, Double) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSSSd_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32, _ param1Bytes: Int32, _ param1Length: Int32, _ param2: Float64) -> Void { +@_expose(wasm, "bjs_ArrayIdentityElement_tag_set") +@_cdecl("bjs_ArrayIdentityElement_tag_set") +public func _bjs_ArrayIdentityElement_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int, String, Double) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Int.bridgeJSLiftParameter(param0), String.bridgeJSLiftParameter(param1Bytes, param1Length), Double.bridgeJSLiftParameter(param2)) - return result.bridgeJSLowerReturn() + ArrayIdentityElement.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ callback: Int32, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(callback, param0, param1, param2) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSiSi_Si { - static func bridgeJSLift(_ callbackId: Int32) -> (Int, Int, Int) -> Int { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] (param0, param1, param2) in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - let param1Value = param1.bridgeJSLowerParameter() - let param2Value = param2.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(callbackValue, param0Value, param1Value, param2Value) - return Int.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Int, Int, Int) -> Int { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int, Int, Int) -> Int) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32, _ param1: Int32, _ param2: Int32) -> Int32 { +@_expose(wasm, "bjs_ArrayIdentityElement_deinit") +@_cdecl("bjs_ArrayIdentityElement_deinit") +public func _bjs_ArrayIdentityElement_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int, Int, Int) -> Int>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Int.bridgeJSLiftParameter(param0), Int.bridgeJSLiftParameter(param1), Int.bridgeJSLiftParameter(param2)) - return result.bridgeJSLowerReturn() + Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") #endif } -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ callback: Int32, _ param0: Int32, _ param1: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(callback, param0, param1) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSiSi_Si { - static func bridgeJSLift(_ callbackId: Int32) -> (Int, Int) -> Int { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] (param0, param1) in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - let param1Value = param1.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(callbackValue, param0Value, param1Value) - return Int.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } +extension ArrayIdentityElement: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque())))) } -} - -extension JSTypedClosure where Signature == (Int, Int) -> Int { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int, Int) -> Int) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si, - body: body, - fileID: fileID, - line: line - ) + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque()) } } -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSiSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32, _ param1: Int32) -> Int32 { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int, Int) -> Int>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Int.bridgeJSLiftParameter(param0), Int.bridgeJSLiftParameter(param1)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(_ callback: Int32, _ param0: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ callback: Int32, _ param0: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(callback, param0) -} - #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 +@_extern(wasm, module: "BridgeJSIdentityTests", name: "bjs_ArrayIdentityElement_wrap") +fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 #else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { +fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } #endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_Si { - static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Int { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(callbackValue, param0Value) - return Int.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Int) -> Int { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int) -> Int) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_Si(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Int32 { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int) -> Int>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Int.bridgeJSLiftParameter(param0)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif +@inline(never) fileprivate func _bjs_ArrayIdentityElement_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ArrayIdentityElement_wrap_extern(pointer) } #if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(_ callback: Int32, _ param0: Int32) -> Void +@_extern(wasm, module: "BridgeJSIdentityTests", name: "bjs_IdentityModeTestImports_runJsIdentityModeTests_static") +fileprivate func bjs_IdentityModeTestImports_runJsIdentityModeTests_static_extern() -> Void #else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(_ callback: Int32, _ param0: Int32) -> Void { +fileprivate func bjs_IdentityModeTestImports_runJsIdentityModeTests_static_extern() -> Void { fatalError("Only available on WebAssembly") } #endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ callback: Int32, _ param0: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(callback, param0) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSi_y { - static func bridgeJSLift(_ callbackId: Int32) -> (Int) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(callbackValue, param0Value) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Int) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Int) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSi_y(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Int) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure(Int.bridgeJSLiftParameter(param0)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0ObjectId: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0ObjectId: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0ObjectId: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(callback, param0IsSome, param0ObjectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSq13DataProcessorP_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let (param0IsSome, param0ObjectId): (Int32, Int32) - if let param0 { - (param0IsSome, param0ObjectId) = (1, (param0 as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) - } else { - (param0IsSome, param0ObjectId) = (0, 0) - } - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS(callbackValue, param0IsSome, param0ObjectId) - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq13DataProcessorP_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(callback, param0IsSome, param0Bytes, param0Length) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let ret0 = param0.bridgeJSWithLoweredParameter { (param0IsSome, param0Bytes, param0Length) in - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(callbackValue, param0IsSome, param0Bytes, param0Length) - return ret - } - let ret = ret0 - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq5ThemeO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(callback, param0IsSome, param0Pointer) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let (param0IsSome, param0Pointer) = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(callbackValue, param0IsSome, param0Pointer) - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ callback: Int32, _ param0IsSome: Int32, _ param0Pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(callback, param0IsSome, param0Pointer) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> Optional { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let (param0IsSome, param0Pointer) = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(callbackValue, param0IsSome, param0Pointer) - return Optional.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Optional) -> Optional { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> Optional) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> Optional>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(callback, param0IsSome, param0CaseId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let (param0IsSome, param0CaseId) = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(callbackValue, param0IsSome, param0CaseId) - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9APIResultO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0CaseId: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0CaseId)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(callback, param0IsSome, param0Value) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(callbackValue, param0IsSome, param0Value) - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSq9DirectionO_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(callback, param0IsSome, param0Bytes, param0Length) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let ret0 = param0.bridgeJSWithLoweredParameter { (param0IsSome, param0Bytes, param0Length) in - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(callbackValue, param0IsSome, param0Bytes, param0Length) - return ret - } - let ret = ret0 - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSS_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(callback, param0IsSome, param0Value) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS { - static func bridgeJSLift(_ callbackId: Int32) -> (Optional) -> String { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(callbackValue, param0IsSome, param0Value) - return String.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (Optional) -> String { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (Optional) -> String) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsSqSi_SS(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(Optional) -> String>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(callback, param0Bytes, param0Length) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestss11FeatureFlagO_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending FeatureFlag) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y(callbackValue, param0Bytes, param0Length) - } - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending FeatureFlag) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending FeatureFlag) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11FeatureFlagO_y(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending FeatureFlag) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure(FeatureFlag.bridgeJSLiftParameter(param0Bytes, param0Length)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(_ callback: Int32, _ param0: Int32) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(_ callback: Int32, _ param0: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y(_ callback: Int32, _ param0: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(callback, param0) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestss11WeatherDataC_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending WeatherData) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y(callbackValue, param0Value) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending WeatherData) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending WeatherData) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss11WeatherDataC_y(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending WeatherData) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure(WeatherData.bridgeJSLiftParameter(param0)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(_ callback: Int32, _ param0Kind: Int32, _ param0Payload1: Int32, _ param0Payload2: Float64) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(_ callback: Int32, _ param0Kind: Int32, _ param0Payload1: Int32, _ param0Payload2: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y(_ callback: Int32, _ param0Kind: Int32, _ param0Payload1: Int32, _ param0Payload2: Float64) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(callback, param0Kind, param0Payload1, param0Payload2) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestss7JSValueV_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending JSValue) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let (param0Kind, param0Payload1, param0Payload2) = param0.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y(callbackValue, param0Kind, param0Payload1, param0Payload2) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending JSValue) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending JSValue) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestss7JSValueV_y(_ boxPtr: UnsafeMutableRawPointer, _ param0Kind: Int32, _ param0Payload1: Int32, _ param0Payload2: Float64) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending JSValue) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure(JSValue.bridgeJSLiftParameter(param0Kind, param0Payload1, param0Payload2)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y(_ callback: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(callback, param0Bytes, param0Length) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestssSS_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending String) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - param0.bridgeJSWithLoweredParameter { (param0Bytes, param0Length) in - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y(callbackValue, param0Bytes, param0Length) - } - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending String) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending String) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSS_y(_ boxPtr: UnsafeMutableRawPointer, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending String) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure(String.bridgeJSLiftParameter(param0Bytes, param0Length)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(_ callback: Int32) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(_ callback: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y(_ callback: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestssSaSS_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending [String]) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let _ = param0.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y(callbackValue) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending [String]) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending [String]) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSS_y(_ boxPtr: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending [String]) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure([String].bridgeJSLiftParameter()) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(_ callback: Int32) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(_ callback: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y(_ callback: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestssSaSb_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending [Bool]) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let _ = param0.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y(callbackValue) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending [Bool]) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending [Bool]) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSb_y(_ boxPtr: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending [Bool]) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure([Bool].bridgeJSLiftParameter()) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(_ callback: Int32) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(_ callback: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y(_ callback: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestssSaSd_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending [Double]) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let _ = param0.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y(callbackValue) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending [Double]) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending [Double]) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSaSd_y(_ boxPtr: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending [Double]) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure([Double].bridgeJSLiftParameter()) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(_ callback: Int32, _ param0: Int32) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(_ callback: Int32, _ param0: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y(_ callback: Int32, _ param0: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(callback, param0) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestssSb_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending Bool) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y(callbackValue, param0Value) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending Bool) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending Bool) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSb_y(_ boxPtr: UnsafeMutableRawPointer, _ param0: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending Bool) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure(Bool.bridgeJSLiftParameter(param0)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(_ callback: Int32, _ param0: Float64) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(_ callback: Int32, _ param0: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y(_ callback: Int32, _ param0: Float64) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(callback, param0) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestssSd_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending Double) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let param0Value = param0.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y(callbackValue, param0Value) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending Double) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending Double) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSd_y(_ boxPtr: UnsafeMutableRawPointer, _ param0: Float64) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending Double) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure(Double.bridgeJSLiftParameter(param0)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y(_ callback: Int32, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(callback, param0IsSome, param0Bytes, param0Length) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestssSqSS_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending Optional) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - param0.bridgeJSWithLoweredParameter { (param0IsSome, param0Bytes, param0Length) in - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y(callbackValue, param0IsSome, param0Bytes, param0Length) - } - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending Optional) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending Optional) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSS_y(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Bytes: Int32, _ param0Length: Int32) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending Optional) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Bytes, param0Length)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y(_ callback: Int32, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(callback, param0IsSome, param0Value) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestssSqSd_y { - static func bridgeJSLift(_ callbackId: Int32) -> (sending Optional) -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] param0 in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let (param0IsSome, param0Value) = param0.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y(callbackValue, param0IsSome, param0Value) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == (sending Optional) -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping (sending Optional) -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestssSqSd_y(_ boxPtr: UnsafeMutableRawPointer, _ param0IsSome: Int32, _ param0Value: Float64) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<(sending Optional) -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure(Optional.bridgeJSLiftParameter(param0IsSome, param0Value)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(_ callback: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(_ callback: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP(_ callback: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsy_13DataProcessorP { - static func bridgeJSLift(_ callbackId: Int32) -> () -> any DataProcessor { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP(callbackValue) - return AnyDataProcessor.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == () -> any DataProcessor { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping () -> any DataProcessor) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_13DataProcessorP(_ boxPtr: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<() -> any DataProcessor>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure() - return (result as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(_ callback: Int32) -> Int32 -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(_ callback: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ callback: Int32) -> Int32 { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsy_Sb { - static func bridgeJSLift(_ callbackId: Int32) -> () -> Bool { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(callbackValue) - return Bool.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == () -> Bool { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping () -> Bool) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sb(_ boxPtr: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<() -> Bool>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure() - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(_ callback: Int32) -> UnsafeMutableRawPointer -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(_ callback: Int32) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ callback: Int32) -> UnsafeMutableRawPointer { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsy_Sq7GreeterC { - static func bridgeJSLift(_ callbackId: Int32) -> () -> Optional { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - let ret = invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(callbackValue) - return Optional.bridgeJSLiftReturn(ret) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == () -> Optional { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping () -> Optional) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_Sq7GreeterC(_ boxPtr: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<() -> Optional>>.fromOpaque(boxPtr).takeUnretainedValue().closure - let result = closure() - return result.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(_ callback: Int32) -> Void -#else -fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(_ callback: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ callback: Int32) -> Void { - return invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 -#else -fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ boxPtr: UnsafeMutableRawPointer, _ file: UnsafePointer, _ line: UInt32) -> Int32 { - return make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y_extern(boxPtr, file, line) -} - -private enum _BJS_Closure_20BridgeJSRuntimeTestsy_y { - static func bridgeJSLift(_ callbackId: Int32) -> () -> Void { - let callback = JSObject.bridgeJSLiftParameter(callbackId) - return { [callback] in - #if arch(wasm32) - let callbackValue = callback.bridgeJSLowerParameter() - invoke_js_callback_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(callbackValue) - #else - fatalError("Only available on WebAssembly") - #endif - } - } -} - -extension JSTypedClosure where Signature == () -> Void { - init(fileID: StaticString = #fileID, line: UInt32 = #line, _ body: @escaping () -> Void) { - self.init( - makeClosure: make_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y, - body: body, - fileID: fileID, - line: line - ) - } -} - -@_expose(wasm, "invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") -@_cdecl("invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y") -public func _invoke_swift_closure_BridgeJSRuntimeTests_20BridgeJSRuntimeTestsy_y(_ boxPtr: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let closure = Unmanaged<_BridgeJSTypedClosureBox<() -> Void>>.fromOpaque(boxPtr).takeUnretainedValue().closure - closure() - #else - fatalError("Only available on WebAssembly") - #endif -} - -struct AnyArrayElementProtocol: ArrayElementProtocol, _BridgedSwiftProtocolWrapper { - let jsObject: JSObject - - var value: Int { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = bjs_ArrayElementProtocol_value_get(jsObjectValue) - return Int.bridgeJSLiftReturn(ret) - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_ArrayElementProtocol_value_set(jsObjectValue, newValueValue) - } - } - - static func bridgeJSLiftParameter(_ value: Int32) -> Self { - return AnyArrayElementProtocol(jsObject: JSObject(id: UInt32(bitPattern: value))) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayElementProtocol_value_get") -fileprivate func bjs_ArrayElementProtocol_value_get_extern(_ jsObject: Int32) -> Int32 -#else -fileprivate func bjs_ArrayElementProtocol_value_get_extern(_ jsObject: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArrayElementProtocol_value_get(_ jsObject: Int32) -> Int32 { - return bjs_ArrayElementProtocol_value_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayElementProtocol_value_set") -fileprivate func bjs_ArrayElementProtocol_value_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void -#else -fileprivate func bjs_ArrayElementProtocol_value_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArrayElementProtocol_value_set(_ jsObject: Int32, _ newValue: Int32) -> Void { - return bjs_ArrayElementProtocol_value_set_extern(jsObject, newValue) -} - -struct AnyDataProcessor: DataProcessor, _BridgedSwiftProtocolWrapper { - let jsObject: JSObject - - func increment(by amount: Int) -> Void { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let amountValue = amount.bridgeJSLowerParameter() - _extern_increment(jsObjectValue, amountValue) - } - - func getValue() -> Int { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = _extern_getValue(jsObjectValue) - return Int.bridgeJSLiftReturn(ret) - } - - func setLabelElements(_ labelPrefix: String, _ labelSuffix: String) -> Void { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - labelPrefix.bridgeJSWithLoweredParameter { (labelPrefixBytes, labelPrefixLength) in - labelSuffix.bridgeJSWithLoweredParameter { (labelSuffixBytes, labelSuffixLength) in - _extern_setLabelElements(jsObjectValue, labelPrefixBytes, labelPrefixLength, labelSuffixBytes, labelSuffixLength) - } - } - } - - func getLabel() -> String { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = _extern_getLabel(jsObjectValue) - return String.bridgeJSLiftReturn(ret) - } - - func isEven() -> Bool { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = _extern_isEven(jsObjectValue) - return Bool.bridgeJSLiftReturn(ret) - } - - func processGreeter(_ greeter: Greeter) -> String { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let greeterPointer = greeter.bridgeJSLowerParameter() - let ret = _extern_processGreeter(jsObjectValue, greeterPointer) - return String.bridgeJSLiftReturn(ret) - } - - func createGreeter() -> Greeter { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = _extern_createGreeter(jsObjectValue) - return Greeter.bridgeJSLiftReturn(ret) - } - - func processOptionalGreeter(_ greeter: Optional) -> String { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameter() - let ret = _extern_processOptionalGreeter(jsObjectValue, greeterIsSome, greeterPointer) - return String.bridgeJSLiftReturn(ret) - } - - func createOptionalGreeter() -> Optional { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = _extern_createOptionalGreeter(jsObjectValue) - return Optional.bridgeJSLiftReturn(ret) - } - - func handleAPIResult(_ result: Optional) -> Void { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let (resultIsSome, resultCaseId) = result.bridgeJSLowerParameter() - _extern_handleAPIResult(jsObjectValue, resultIsSome, resultCaseId) - } - - func getAPIResult() -> Optional { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = _extern_getAPIResult(jsObjectValue) - return Optional.bridgeJSLiftReturn(ret) - } - - var count: Int { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = bjs_DataProcessor_count_get(jsObjectValue) - return Int.bridgeJSLiftReturn(ret) - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_DataProcessor_count_set(jsObjectValue, newValueValue) - } - } - - var name: String { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = bjs_DataProcessor_name_get(jsObjectValue) - return String.bridgeJSLiftReturn(ret) - } - } - - var optionalTag: Optional { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - bjs_DataProcessor_optionalTag_get(jsObjectValue) - return Optional.bridgeJSLiftReturnFromSideChannel() - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - newValue.bridgeJSWithLoweredParameter { (newValueIsSome, newValueBytes, newValueLength) in - bjs_DataProcessor_optionalTag_set(jsObjectValue, newValueIsSome, newValueBytes, newValueLength) - } - } - } - - var optionalCount: Optional { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - bjs_DataProcessor_optionalCount_get(jsObjectValue) - return Optional.bridgeJSLiftReturnFromSideChannel() - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() - bjs_DataProcessor_optionalCount_set(jsObjectValue, newValueIsSome, newValueValue) - } - } - - var direction: Optional { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = bjs_DataProcessor_direction_get(jsObjectValue) - return Optional.bridgeJSLiftReturn(ret) - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() - bjs_DataProcessor_direction_set(jsObjectValue, newValueIsSome, newValueValue) - } - } - - var optionalTheme: Optional { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - bjs_DataProcessor_optionalTheme_get(jsObjectValue) - return Optional.bridgeJSLiftReturnFromSideChannel() - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - newValue.bridgeJSWithLoweredParameter { (newValueIsSome, newValueBytes, newValueLength) in - bjs_DataProcessor_optionalTheme_set(jsObjectValue, newValueIsSome, newValueBytes, newValueLength) - } - } - } - - var httpStatus: Optional { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - bjs_DataProcessor_httpStatus_get(jsObjectValue) - return Optional.bridgeJSLiftReturnFromSideChannel() - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter() - bjs_DataProcessor_httpStatus_set(jsObjectValue, newValueIsSome, newValueValue) - } - } - - var apiResult: Optional { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = bjs_DataProcessor_apiResult_get(jsObjectValue) - return Optional.bridgeJSLiftReturn(ret) - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let (newValueIsSome, newValueCaseId) = newValue.bridgeJSLowerParameter() - bjs_DataProcessor_apiResult_set(jsObjectValue, newValueIsSome, newValueCaseId) - } - } - - var helper: Greeter { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = bjs_DataProcessor_helper_get(jsObjectValue) - return Greeter.bridgeJSLiftReturn(ret) - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let newValuePointer = newValue.bridgeJSLowerParameter() - bjs_DataProcessor_helper_set(jsObjectValue, newValuePointer) - } - } - - var optionalHelper: Optional { - get { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let ret = bjs_DataProcessor_optionalHelper_get(jsObjectValue) - return Optional.bridgeJSLiftReturn(ret) - } - set { - let jsObjectValue = jsObject.bridgeJSLowerParameter() - let (newValueIsSome, newValuePointer) = newValue.bridgeJSLowerParameter() - bjs_DataProcessor_optionalHelper_set(jsObjectValue, newValueIsSome, newValuePointer) - } - } - - static func bridgeJSLiftParameter(_ value: Int32) -> Self { - return AnyDataProcessor(jsObject: JSObject(id: UInt32(bitPattern: value))) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_increment") -fileprivate func _extern_increment_extern(_ jsObject: Int32, _ amount: Int32) -> Void -#else -fileprivate func _extern_increment_extern(_ jsObject: Int32, _ amount: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_increment(_ jsObject: Int32, _ amount: Int32) -> Void { - return _extern_increment_extern(jsObject, amount) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getValue") -fileprivate func _extern_getValue_extern(_ jsObject: Int32) -> Int32 -#else -fileprivate func _extern_getValue_extern(_ jsObject: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_getValue(_ jsObject: Int32) -> Int32 { - return _extern_getValue_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_setLabelElements") -fileprivate func _extern_setLabelElements_extern(_ jsObject: Int32, _ labelPrefixBytes: Int32, _ labelPrefixLength: Int32, _ labelSuffixBytes: Int32, _ labelSuffixLength: Int32) -> Void -#else -fileprivate func _extern_setLabelElements_extern(_ jsObject: Int32, _ labelPrefixBytes: Int32, _ labelPrefixLength: Int32, _ labelSuffixBytes: Int32, _ labelSuffixLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_setLabelElements(_ jsObject: Int32, _ labelPrefixBytes: Int32, _ labelPrefixLength: Int32, _ labelSuffixBytes: Int32, _ labelSuffixLength: Int32) -> Void { - return _extern_setLabelElements_extern(jsObject, labelPrefixBytes, labelPrefixLength, labelSuffixBytes, labelSuffixLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getLabel") -fileprivate func _extern_getLabel_extern(_ jsObject: Int32) -> Int32 -#else -fileprivate func _extern_getLabel_extern(_ jsObject: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_getLabel(_ jsObject: Int32) -> Int32 { - return _extern_getLabel_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_isEven") -fileprivate func _extern_isEven_extern(_ jsObject: Int32) -> Int32 -#else -fileprivate func _extern_isEven_extern(_ jsObject: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_isEven(_ jsObject: Int32) -> Int32 { - return _extern_isEven_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processGreeter") -fileprivate func _extern_processGreeter_extern(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _extern_processGreeter_extern(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_processGreeter(_ jsObject: Int32, _ greeter: UnsafeMutableRawPointer) -> Int32 { - return _extern_processGreeter_extern(jsObject, greeter) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createGreeter") -fileprivate func _extern_createGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer -#else -fileprivate func _extern_createGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_createGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer { - return _extern_createGreeter_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_processOptionalGreeter") -fileprivate func _extern_processOptionalGreeter_extern(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _extern_processOptionalGreeter_extern(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_processOptionalGreeter(_ jsObject: Int32, _ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> Int32 { - return _extern_processOptionalGreeter_extern(jsObject, greeterIsSome, greeterPointer) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_createOptionalGreeter") -fileprivate func _extern_createOptionalGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer -#else -fileprivate func _extern_createOptionalGreeter_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_createOptionalGreeter(_ jsObject: Int32) -> UnsafeMutableRawPointer { - return _extern_createOptionalGreeter_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_handleAPIResult") -fileprivate func _extern_handleAPIResult_extern(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void -#else -fileprivate func _extern_handleAPIResult_extern(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_handleAPIResult(_ jsObject: Int32, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { - return _extern_handleAPIResult_extern(jsObject, resultIsSome, resultCaseId) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_getAPIResult") -fileprivate func _extern_getAPIResult_extern(_ jsObject: Int32) -> Int32 -#else -fileprivate func _extern_getAPIResult_extern(_ jsObject: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _extern_getAPIResult(_ jsObject: Int32) -> Int32 { - return _extern_getAPIResult_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_get") -fileprivate func bjs_DataProcessor_count_get_extern(_ jsObject: Int32) -> Int32 -#else -fileprivate func bjs_DataProcessor_count_get_extern(_ jsObject: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_count_get(_ jsObject: Int32) -> Int32 { - return bjs_DataProcessor_count_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_count_set") -fileprivate func bjs_DataProcessor_count_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_count_set_extern(_ jsObject: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_count_set(_ jsObject: Int32, _ newValue: Int32) -> Void { - return bjs_DataProcessor_count_set_extern(jsObject, newValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_name_get") -fileprivate func bjs_DataProcessor_name_get_extern(_ jsObject: Int32) -> Int32 -#else -fileprivate func bjs_DataProcessor_name_get_extern(_ jsObject: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_name_get(_ jsObject: Int32) -> Int32 { - return bjs_DataProcessor_name_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_get") -fileprivate func bjs_DataProcessor_optionalTag_get_extern(_ jsObject: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_optionalTag_get_extern(_ jsObject: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_optionalTag_get(_ jsObject: Int32) -> Void { - return bjs_DataProcessor_optionalTag_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTag_set") -fileprivate func bjs_DataProcessor_optionalTag_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_optionalTag_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_optionalTag_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - return bjs_DataProcessor_optionalTag_set_extern(jsObject, newValueIsSome, newValueBytes, newValueLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_get") -fileprivate func bjs_DataProcessor_optionalCount_get_extern(_ jsObject: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_optionalCount_get_extern(_ jsObject: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_optionalCount_get(_ jsObject: Int32) -> Void { - return bjs_DataProcessor_optionalCount_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalCount_set") -fileprivate func bjs_DataProcessor_optionalCount_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_optionalCount_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_optionalCount_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { - return bjs_DataProcessor_optionalCount_set_extern(jsObject, newValueIsSome, newValueValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_get") -fileprivate func bjs_DataProcessor_direction_get_extern(_ jsObject: Int32) -> Int32 -#else -fileprivate func bjs_DataProcessor_direction_get_extern(_ jsObject: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_direction_get(_ jsObject: Int32) -> Int32 { - return bjs_DataProcessor_direction_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_direction_set") -fileprivate func bjs_DataProcessor_direction_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_direction_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_direction_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { - return bjs_DataProcessor_direction_set_extern(jsObject, newValueIsSome, newValueValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_get") -fileprivate func bjs_DataProcessor_optionalTheme_get_extern(_ jsObject: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_optionalTheme_get_extern(_ jsObject: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_optionalTheme_get(_ jsObject: Int32) -> Void { - return bjs_DataProcessor_optionalTheme_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalTheme_set") -fileprivate func bjs_DataProcessor_optionalTheme_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_optionalTheme_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_optionalTheme_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - return bjs_DataProcessor_optionalTheme_set_extern(jsObject, newValueIsSome, newValueBytes, newValueLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_get") -fileprivate func bjs_DataProcessor_httpStatus_get_extern(_ jsObject: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_httpStatus_get_extern(_ jsObject: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_httpStatus_get(_ jsObject: Int32) -> Void { - return bjs_DataProcessor_httpStatus_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_httpStatus_set") -fileprivate func bjs_DataProcessor_httpStatus_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_httpStatus_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_httpStatus_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueValue: Int32) -> Void { - return bjs_DataProcessor_httpStatus_set_extern(jsObject, newValueIsSome, newValueValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_get") -fileprivate func bjs_DataProcessor_apiResult_get_extern(_ jsObject: Int32) -> Int32 -#else -fileprivate func bjs_DataProcessor_apiResult_get_extern(_ jsObject: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_apiResult_get(_ jsObject: Int32) -> Int32 { - return bjs_DataProcessor_apiResult_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_apiResult_set") -fileprivate func bjs_DataProcessor_apiResult_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void -#else -fileprivate func bjs_DataProcessor_apiResult_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_apiResult_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValueCaseId: Int32) -> Void { - return bjs_DataProcessor_apiResult_set_extern(jsObject, newValueIsSome, newValueCaseId) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_get") -fileprivate func bjs_DataProcessor_helper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer -#else -fileprivate func bjs_DataProcessor_helper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_helper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer { - return bjs_DataProcessor_helper_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_helper_set") -fileprivate func bjs_DataProcessor_helper_set_extern(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void -#else -fileprivate func bjs_DataProcessor_helper_set_extern(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_helper_set(_ jsObject: Int32, _ newValue: UnsafeMutableRawPointer) -> Void { - return bjs_DataProcessor_helper_set_extern(jsObject, newValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_get") -fileprivate func bjs_DataProcessor_optionalHelper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer -#else -fileprivate func bjs_DataProcessor_optionalHelper_get_extern(_ jsObject: Int32) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_optionalHelper_get(_ jsObject: Int32) -> UnsafeMutableRawPointer { - return bjs_DataProcessor_optionalHelper_get_extern(jsObject) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessor_optionalHelper_set") -fileprivate func bjs_DataProcessor_optionalHelper_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void -#else -fileprivate func bjs_DataProcessor_optionalHelper_set_extern(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DataProcessor_optionalHelper_set(_ jsObject: Int32, _ newValueIsSome: Int32, _ newValuePointer: UnsafeMutableRawPointer) -> Void { - return bjs_DataProcessor_optionalHelper_set_extern(jsObject, newValueIsSome, newValuePointer) -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripIntArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripIntArray") -public func _bjs_ArraySupportExports_static_roundTripIntArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripIntArray(_: [Int].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripStringArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripStringArray") -public func _bjs_ArraySupportExports_static_roundTripStringArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripStringArray(_: [String].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripDoubleArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripDoubleArray") -public func _bjs_ArraySupportExports_static_roundTripDoubleArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripDoubleArray(_: [Double].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripBoolArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripBoolArray") -public func _bjs_ArraySupportExports_static_roundTripBoolArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripBoolArray(_: [Bool].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUnsafeRawPointerArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripUnsafeRawPointerArray") -public func _bjs_ArraySupportExports_static_roundTripUnsafeRawPointerArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripUnsafeRawPointerArray(_: [UnsafeRawPointer].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUnsafeMutableRawPointerArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripUnsafeMutableRawPointerArray") -public func _bjs_ArraySupportExports_static_roundTripUnsafeMutableRawPointerArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripUnsafeMutableRawPointerArray(_: [UnsafeMutableRawPointer].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOpaquePointerArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOpaquePointerArray") -public func _bjs_ArraySupportExports_static_roundTripOpaquePointerArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOpaquePointerArray(_: [OpaquePointer].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUnsafePointerArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripUnsafePointerArray") -public func _bjs_ArraySupportExports_static_roundTripUnsafePointerArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripUnsafePointerArray(_: [UnsafePointer].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUnsafeMutablePointerArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripUnsafeMutablePointerArray") -public func _bjs_ArraySupportExports_static_roundTripUnsafeMutablePointerArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripUnsafeMutablePointerArray(_: [UnsafeMutablePointer].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripJSValueArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripJSValueArray") -public func _bjs_ArraySupportExports_static_roundTripJSValueArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripJSValueArray(_: [JSValue].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripJSObjectArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripJSObjectArray") -public func _bjs_ArraySupportExports_static_roundTripJSObjectArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripJSObjectArray(_: [JSObject].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripCaseEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripCaseEnumArray") -public func _bjs_ArraySupportExports_static_roundTripCaseEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripCaseEnumArray(_: [Direction].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripStringRawValueEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripStringRawValueEnumArray") -public func _bjs_ArraySupportExports_static_roundTripStringRawValueEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripStringRawValueEnumArray(_: [Theme].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripIntRawValueEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripIntRawValueEnumArray") -public func _bjs_ArraySupportExports_static_roundTripIntRawValueEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripIntRawValueEnumArray(_: [HttpStatus].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray") -public func _bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripInt64RawValueEnumArray(_: [FileSize].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray") -public func _bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripUInt64RawValueEnumArray(_: [SessionId].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripStructArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripStructArray") -public func _bjs_ArraySupportExports_static_roundTripStructArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripStructArray(_: [DataPoint].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripSwiftClassArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripSwiftClassArray") -public func _bjs_ArraySupportExports_static_roundTripSwiftClassArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripSwiftClassArray(_: [Greeter].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNamespacedSwiftClassArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripNamespacedSwiftClassArray") -public func _bjs_ArraySupportExports_static_roundTripNamespacedSwiftClassArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripNamespacedSwiftClassArray(_: [Utils.Converter].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripProtocolArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripProtocolArray") -public func _bjs_ArraySupportExports_static_roundTripProtocolArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripProtocolArray(_: [AnyArrayElementProtocol].bridgeJSStackPop()) - for __bjs_elem_ret in ret { - _swift_js_push_i32((__bjs_elem_ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) - } - _swift_js_push_i32(Int32(ret.count)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripJSClassArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripJSClassArray") -public func _bjs_ArraySupportExports_static_roundTripJSClassArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripJSClassArray(_: [ArrayElementObject].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalIntArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalIntArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalIntArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalIntArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalStringArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalStringArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalStringArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalStringArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalJSObjectArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalJSObjectArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalJSObjectArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalJSObjectArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalCaseEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalCaseEnumArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalCaseEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalCaseEnumArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalStringRawValueEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalStringRawValueEnumArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalStringRawValueEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalStringRawValueEnumArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalIntRawValueEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalIntRawValueEnumArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalIntRawValueEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalIntRawValueEnumArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalInt64RawValueEnumArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalUInt64RawValueEnumArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalStructArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalStructArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalStructArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalStructArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalSwiftClassArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripOptionalJSClassArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripOptionalJSClassArray") -public func _bjs_ArraySupportExports_static_roundTripOptionalJSClassArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripOptionalJSClassArray(_: [Optional].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedIntArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripNestedIntArray") -public func _bjs_ArraySupportExports_static_roundTripNestedIntArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripNestedIntArray(_: [[Int]].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedStringArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripNestedStringArray") -public func _bjs_ArraySupportExports_static_roundTripNestedStringArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripNestedStringArray(_: [[String]].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedDoubleArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripNestedDoubleArray") -public func _bjs_ArraySupportExports_static_roundTripNestedDoubleArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripNestedDoubleArray(_: [[Double]].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedBoolArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripNestedBoolArray") -public func _bjs_ArraySupportExports_static_roundTripNestedBoolArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripNestedBoolArray(_: [[Bool]].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedStructArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripNestedStructArray") -public func _bjs_ArraySupportExports_static_roundTripNestedStructArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripNestedStructArray(_: [[DataPoint]].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedCaseEnumArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripNestedCaseEnumArray") -public func _bjs_ArraySupportExports_static_roundTripNestedCaseEnumArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripNestedCaseEnumArray(_: [[Direction]].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_roundTripNestedSwiftClassArray") -@_cdecl("bjs_ArraySupportExports_static_roundTripNestedSwiftClassArray") -public func _bjs_ArraySupportExports_static_roundTripNestedSwiftClassArray() -> Void { - #if arch(wasm32) - let ret = ArraySupportExports.roundTripNestedSwiftClassArray(_: [[Greeter]].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_multiArrayFirst") -@_cdecl("bjs_ArraySupportExports_static_multiArrayFirst") -public func _bjs_ArraySupportExports_static_multiArrayFirst() -> Void { - #if arch(wasm32) - let _tmp_b = [String].bridgeJSStackPop() - let _tmp_a = [Int].bridgeJSStackPop() - let ret = ArraySupportExports.multiArrayFirst(_: _tmp_a, _: _tmp_b) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_multiArraySecond") -@_cdecl("bjs_ArraySupportExports_static_multiArraySecond") -public func _bjs_ArraySupportExports_static_multiArraySecond() -> Void { - #if arch(wasm32) - let _tmp_b = [String].bridgeJSStackPop() - let _tmp_a = [Int].bridgeJSStackPop() - let ret = ArraySupportExports.multiArraySecond(_: _tmp_a, _: _tmp_b) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_multiOptionalArrayFirst") -@_cdecl("bjs_ArraySupportExports_static_multiOptionalArrayFirst") -public func _bjs_ArraySupportExports_static_multiOptionalArrayFirst() -> Void { - #if arch(wasm32) - let _tmp_b = Optional<[String]>.bridgeJSLiftParameter() - let _tmp_a = Optional<[Int]>.bridgeJSLiftParameter() - let ret = ArraySupportExports.multiOptionalArrayFirst(_: _tmp_a, _: _tmp_b) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArraySupportExports_static_multiOptionalArraySecond") -@_cdecl("bjs_ArraySupportExports_static_multiOptionalArraySecond") -public func _bjs_ArraySupportExports_static_multiOptionalArraySecond() -> Void { - #if arch(wasm32) - let _tmp_b = Optional<[String]>.bridgeJSLiftParameter() - let _tmp_a = Optional<[Int]>.bridgeJSLiftParameter() - let ret = ArraySupportExports.multiOptionalArraySecond(_: _tmp_a, _: _tmp_b) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testStringDefault") -@_cdecl("bjs_DefaultArgumentExports_static_testStringDefault") -public func _bjs_DefaultArgumentExports_static_testStringDefault(_ messageBytes: Int32, _ messageLength: Int32) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentExports.testStringDefault(message: String.bridgeJSLiftParameter(messageBytes, messageLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testIntDefault") -@_cdecl("bjs_DefaultArgumentExports_static_testIntDefault") -public func _bjs_DefaultArgumentExports_static_testIntDefault(_ count: Int32) -> Int32 { - #if arch(wasm32) - let ret = DefaultArgumentExports.testIntDefault(count: Int.bridgeJSLiftParameter(count)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testBoolDefault") -@_cdecl("bjs_DefaultArgumentExports_static_testBoolDefault") -public func _bjs_DefaultArgumentExports_static_testBoolDefault(_ flag: Int32) -> Int32 { - #if arch(wasm32) - let ret = DefaultArgumentExports.testBoolDefault(flag: Bool.bridgeJSLiftParameter(flag)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testOptionalDefault") -@_cdecl("bjs_DefaultArgumentExports_static_testOptionalDefault") -public func _bjs_DefaultArgumentExports_static_testOptionalDefault(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentExports.testOptionalDefault(name: Optional.bridgeJSLiftParameter(nameIsSome, nameBytes, nameLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testMultipleDefaults") -@_cdecl("bjs_DefaultArgumentExports_static_testMultipleDefaults") -public func _bjs_DefaultArgumentExports_static_testMultipleDefaults(_ titleBytes: Int32, _ titleLength: Int32, _ count: Int32, _ enabled: Int32) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentExports.testMultipleDefaults(title: String.bridgeJSLiftParameter(titleBytes, titleLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testSimpleEnumDefault") -@_cdecl("bjs_DefaultArgumentExports_static_testSimpleEnumDefault") -public func _bjs_DefaultArgumentExports_static_testSimpleEnumDefault(_ status: Int32) -> Int32 { - #if arch(wasm32) - let ret = DefaultArgumentExports.testSimpleEnumDefault(status: Status.bridgeJSLiftParameter(status)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testDirectionDefault") -@_cdecl("bjs_DefaultArgumentExports_static_testDirectionDefault") -public func _bjs_DefaultArgumentExports_static_testDirectionDefault(_ direction: Int32) -> Int32 { - #if arch(wasm32) - let ret = DefaultArgumentExports.testDirectionDefault(direction: Direction.bridgeJSLiftParameter(direction)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testRawStringEnumDefault") -@_cdecl("bjs_DefaultArgumentExports_static_testRawStringEnumDefault") -public func _bjs_DefaultArgumentExports_static_testRawStringEnumDefault(_ themeBytes: Int32, _ themeLength: Int32) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentExports.testRawStringEnumDefault(theme: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testComplexInit") -@_cdecl("bjs_DefaultArgumentExports_static_testComplexInit") -public func _bjs_DefaultArgumentExports_static_testComplexInit(_ greeter: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentExports.testComplexInit(greeter: Greeter.bridgeJSLiftParameter(greeter)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_testEmptyInit") -@_cdecl("bjs_DefaultArgumentExports_static_testEmptyInit") -public func _bjs_DefaultArgumentExports_static_testEmptyInit(_ object: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = DefaultArgumentExports.testEmptyInit(_: StaticPropertyHolder.bridgeJSLiftParameter(object)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_createConstructorDefaults") -@_cdecl("bjs_DefaultArgumentExports_static_createConstructorDefaults") -public func _bjs_DefaultArgumentExports_static_createConstructorDefaults(_ nameBytes: Int32, _ nameLength: Int32, _ count: Int32, _ enabled: Int32, _ status: Int32, _ tagIsSome: Int32, _ tagBytes: Int32, _ tagLength: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = DefaultArgumentExports.createConstructorDefaults(name: String.bridgeJSLiftParameter(nameBytes, nameLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled), status: Status.bridgeJSLiftParameter(status), tag: Optional.bridgeJSLiftParameter(tagIsSome, tagBytes, tagLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_describeConstructorDefaults") -@_cdecl("bjs_DefaultArgumentExports_static_describeConstructorDefaults") -public func _bjs_DefaultArgumentExports_static_describeConstructorDefaults(_ value: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentExports.describeConstructorDefaults(_: DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_arrayWithDefault") -@_cdecl("bjs_DefaultArgumentExports_static_arrayWithDefault") -public func _bjs_DefaultArgumentExports_static_arrayWithDefault() -> Int32 { - #if arch(wasm32) - let ret = DefaultArgumentExports.arrayWithDefault(_: [Int].bridgeJSStackPop()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_arrayWithOptionalDefault") -@_cdecl("bjs_DefaultArgumentExports_static_arrayWithOptionalDefault") -public func _bjs_DefaultArgumentExports_static_arrayWithOptionalDefault() -> Int32 { - #if arch(wasm32) - let ret = DefaultArgumentExports.arrayWithOptionalDefault(_: Optional<[Int]>.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentExports_static_arrayMixedDefaults") -@_cdecl("bjs_DefaultArgumentExports_static_arrayMixedDefaults") -public func _bjs_DefaultArgumentExports_static_arrayMixedDefaults(_ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentExports.arrayMixedDefaults(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength), values: [Int].bridgeJSStackPop(), suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Direction: _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Direction { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Direction { - return Direction(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() - } - - private init?(bridgeJSRawValue: Int32) { - switch bridgeJSRawValue { - case 0: - self = .north - case 1: - self = .south - case 2: - self = .east - case 3: - self = .west - default: - return nil - } - } - - private var bridgeJSRawValue: Int32 { - switch self { - case .north: - return 0 - case .south: - return 1 - case .east: - return 2 - case .west: - return 3 - } - } -} - -extension Status: _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Status { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Status { - return Status(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() - } - - private init?(bridgeJSRawValue: Int32) { - switch bridgeJSRawValue { - case 0: - self = .loading - case 1: - self = .success - case 2: - self = .error - default: - return nil - } - } - - private var bridgeJSRawValue: Int32 { - switch self { - case .loading: - return 0 - case .success: - return 1 - case .error: - return 2 - } - } -} - -extension Theme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { -} - -extension HttpStatus: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { -} - -extension FileSize: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { -} - -extension SessionId: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { -} - -extension Precision: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { -} - -extension Ratio: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { -} - -extension TSDirection: _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> TSDirection { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> TSDirection { - return TSDirection(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() - } - - private init?(bridgeJSRawValue: Int32) { - switch bridgeJSRawValue { - case 0: - self = .north - case 1: - self = .south - case 2: - self = .east - case 3: - self = .west - default: - return nil - } - } - - private var bridgeJSRawValue: Int32 { - switch self { - case .north: - return 0 - case .south: - return 1 - case .east: - return 2 - case .west: - return 3 - } - } -} - -extension TSTheme: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { -} - -@_expose(wasm, "bjs_Utils_StringUtils_static_uppercase") -@_cdecl("bjs_Utils_StringUtils_static_uppercase") -public func _bjs_Utils_StringUtils_static_uppercase(_ textBytes: Int32, _ textLength: Int32) -> Void { - #if arch(wasm32) - let ret = Utils.StringUtils.uppercase(_: String.bridgeJSLiftParameter(textBytes, textLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Utils_StringUtils_static_lowercase") -@_cdecl("bjs_Utils_StringUtils_static_lowercase") -public func _bjs_Utils_StringUtils_static_lowercase(_ textBytes: Int32, _ textLength: Int32) -> Void { - #if arch(wasm32) - let ret = Utils.StringUtils.lowercase(_: String.bridgeJSLiftParameter(textBytes, textLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Networking.API.Method: _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Networking.API.Method { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Networking.API.Method { - return Networking.API.Method(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() - } - - private init?(bridgeJSRawValue: Int32) { - switch bridgeJSRawValue { - case 0: - self = .get - case 1: - self = .post - case 2: - self = .put - case 3: - self = .delete - default: - return nil - } - } - - private var bridgeJSRawValue: Int32 { - switch self { - case .get: - return 0 - case .post: - return 1 - case .put: - return 2 - case .delete: - return 3 - } - } -} - -extension Configuration.LogLevel: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { -} - -extension Configuration.Port: _BridgedSwiftEnumNoPayload, _BridgedSwiftRawValueEnum { -} - -extension Internal.SupportedMethod: _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> Internal.SupportedMethod { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> Internal.SupportedMethod { - return Internal.SupportedMethod(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() - } - - private init?(bridgeJSRawValue: Int32) { - switch bridgeJSRawValue { - case 0: - self = .get - case 1: - self = .post - default: - return nil - } - } - - private var bridgeJSRawValue: Int32 { - switch self { - case .get: - return 0 - case .post: - return 1 - } - } -} - -extension APIResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIResult { - switch caseId { - case 0: - return .success(String.bridgeJSStackPop()) - case 1: - return .failure(Int.bridgeJSStackPop()) - case 2: - return .flag(Bool.bridgeJSStackPop()) - case 3: - return .rate(Float.bridgeJSStackPop()) - case 4: - return .precise(Double.bridgeJSStackPop()) - case 5: - return .info - default: - fatalError("Unknown APIResult case ID: \(caseId)") - } - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { - switch self { - case .success(let param0): - param0.bridgeJSStackPush() - return Int32(0) - case .failure(let param0): - param0.bridgeJSStackPush() - return Int32(1) - case .flag(let param0): - param0.bridgeJSStackPush() - return Int32(2) - case .rate(let param0): - param0.bridgeJSStackPush() - return Int32(3) - case .precise(let param0): - param0.bridgeJSStackPush() - return Int32(4) - case .info: - return Int32(5) - } - } -} - -extension ComplexResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> ComplexResult { - switch caseId { - case 0: - return .success(String.bridgeJSStackPop()) - case 1: - return .error(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) - case 2: - return .location(Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), String.bridgeJSStackPop()) - case 3: - return .status(Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), String.bridgeJSStackPop()) - case 4: - return .coordinates(Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), Double.bridgeJSStackPop()) - case 5: - return .comprehensive(Bool.bridgeJSStackPop(), Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), Int.bridgeJSStackPop(), Double.bridgeJSStackPop(), Double.bridgeJSStackPop(), String.bridgeJSStackPop(), String.bridgeJSStackPop(), String.bridgeJSStackPop()) - case 6: - return .info - default: - fatalError("Unknown ComplexResult case ID: \(caseId)") - } - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { - switch self { - case .success(let param0): - param0.bridgeJSStackPush() - return Int32(0) - case .error(let param0, let param1): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - return Int32(1) - case .location(let param0, let param1, let param2): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - param2.bridgeJSStackPush() - return Int32(2) - case .status(let param0, let param1, let param2): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - param2.bridgeJSStackPush() - return Int32(3) - case .coordinates(let param0, let param1, let param2): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - param2.bridgeJSStackPush() - return Int32(4) - case .comprehensive(let param0, let param1, let param2, let param3, let param4, let param5, let param6, let param7, let param8): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - param2.bridgeJSStackPush() - param3.bridgeJSStackPush() - param4.bridgeJSStackPush() - param5.bridgeJSStackPush() - param6.bridgeJSStackPush() - param7.bridgeJSStackPush() - param8.bridgeJSStackPush() - return Int32(5) - case .info: - return Int32(6) - } - } -} - -extension Utilities.Result: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> Utilities.Result { - switch caseId { - case 0: - return .success(String.bridgeJSStackPop()) - case 1: - return .failure(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) - case 2: - return .status(Bool.bridgeJSStackPop(), Int.bridgeJSStackPop(), String.bridgeJSStackPop()) - default: - fatalError("Unknown Utilities.Result case ID: \(caseId)") - } - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { - switch self { - case .success(let param0): - param0.bridgeJSStackPush() - return Int32(0) - case .failure(let param0, let param1): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - return Int32(1) - case .status(let param0, let param1, let param2): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - param2.bridgeJSStackPush() - return Int32(2) - } - } -} - -extension API.NetworkingResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> API.NetworkingResult { - switch caseId { - case 0: - return .success(String.bridgeJSStackPop()) - case 1: - return .failure(String.bridgeJSStackPop(), Int.bridgeJSStackPop()) - default: - fatalError("Unknown API.NetworkingResult case ID: \(caseId)") - } - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { - switch self { - case .success(let param0): - param0.bridgeJSStackPush() - return Int32(0) - case .failure(let param0, let param1): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - return Int32(1) - } - } -} - -extension AllTypesResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> AllTypesResult { - switch caseId { - case 0: - return .structPayload(Address.bridgeJSStackPop()) - case 1: - return .classPayload(Greeter.bridgeJSStackPop()) - case 2: - return .jsObjectPayload(JSObject.bridgeJSStackPop()) - case 3: - return .nestedEnum(APIResult.bridgeJSStackPop()) - case 4: - return .arrayPayload([Int].bridgeJSStackPop()) - case 5: - return .jsClassPayload(Foo(unsafelyWrapping: JSObject.bridgeJSStackPop())) - case 6: - return .empty - default: - fatalError("Unknown AllTypesResult case ID: \(caseId)") - } - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { - switch self { - case .structPayload(let param0): - param0.bridgeJSStackPush() - return Int32(0) - case .classPayload(let param0): - param0.bridgeJSStackPush() - return Int32(1) - case .jsObjectPayload(let param0): - param0.bridgeJSStackPush() - return Int32(2) - case .nestedEnum(let param0): - param0.bridgeJSStackPush() - return Int32(3) - case .arrayPayload(let param0): - param0.bridgeJSStackPush() - return Int32(4) - case .jsClassPayload(let param0): - param0.jsObject.bridgeJSStackPush() - return Int32(5) - case .empty: - return Int32(6) - } - } -} - -extension TypedPayloadResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> TypedPayloadResult { - switch caseId { - case 0: - return .precision(Precision.bridgeJSStackPop()) - case 1: - return .direction(Direction.bridgeJSStackPop()) - case 2: - return .optPrecision(Optional.bridgeJSStackPop()) - case 3: - return .optDirection(Optional.bridgeJSStackPop()) - case 4: - return .empty - default: - fatalError("Unknown TypedPayloadResult case ID: \(caseId)") - } - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { - switch self { - case .precision(let param0): - param0.bridgeJSStackPush() - return Int32(0) - case .direction(let param0): - param0.bridgeJSStackPush() - return Int32(1) - case .optPrecision(let param0): - param0.bridgeJSStackPush() - return Int32(2) - case .optDirection(let param0): - param0.bridgeJSStackPush() - return Int32(3) - case .empty: - return Int32(4) - } - } -} - -extension StaticCalculator: _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> StaticCalculator { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> StaticCalculator { - return StaticCalculator(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() - } - - private init?(bridgeJSRawValue: Int32) { - switch bridgeJSRawValue { - case 0: - self = .scientific - case 1: - self = .basic - default: - return nil - } - } - - private var bridgeJSRawValue: Int32 { - switch self { - case .scientific: - return 0 - case .basic: - return 1 - } - } -} - -@_expose(wasm, "bjs_StaticCalculator_static_roundtrip") -@_cdecl("bjs_StaticCalculator_static_roundtrip") -public func _bjs_StaticCalculator_static_roundtrip(_ value: Int32) -> Int32 { - #if arch(wasm32) - let ret = StaticCalculator.roundtrip(_: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticCalculator_static_doubleValue") -@_cdecl("bjs_StaticCalculator_static_doubleValue") -public func _bjs_StaticCalculator_static_doubleValue(_ value: Int32) -> Int32 { - #if arch(wasm32) - let ret = StaticCalculator.doubleValue(_: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticCalculator_static_version_get") -@_cdecl("bjs_StaticCalculator_static_version_get") -public func _bjs_StaticCalculator_static_version_get() -> Void { - #if arch(wasm32) - let ret = StaticCalculator.version - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticUtils_Nested_static_roundtrip") -@_cdecl("bjs_StaticUtils_Nested_static_roundtrip") -public func _bjs_StaticUtils_Nested_static_roundtrip(_ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - let ret = StaticUtils.Nested.roundtrip(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Services_Graph_GraphOperations_static_createGraph") -@_cdecl("bjs_Services_Graph_GraphOperations_static_createGraph") -public func _bjs_Services_Graph_GraphOperations_static_createGraph(_ rootId: Int32) -> Int32 { - #if arch(wasm32) - let ret = GraphOperations.createGraph(rootId: Int.bridgeJSLiftParameter(rootId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Services_Graph_GraphOperations_static_nodeCount") -@_cdecl("bjs_Services_Graph_GraphOperations_static_nodeCount") -public func _bjs_Services_Graph_GraphOperations_static_nodeCount(_ graphId: Int32) -> Int32 { - #if arch(wasm32) - let ret = GraphOperations.nodeCount(graphId: Int.bridgeJSLiftParameter(graphId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension StaticPropertyEnum: _BridgedSwiftCaseEnum { - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerParameter() -> Int32 { - return bridgeJSRawValue - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftReturn(_ value: Int32) -> StaticPropertyEnum { - return bridgeJSLiftParameter(value) - } - @_spi(BridgeJS) @_transparent public static func bridgeJSLiftParameter(_ value: Int32) -> StaticPropertyEnum { - return StaticPropertyEnum(bridgeJSRawValue: value)! - } - @_spi(BridgeJS) @_transparent public consuming func bridgeJSLowerReturn() -> Int32 { - return bridgeJSLowerParameter() - } - - private init?(bridgeJSRawValue: Int32) { - switch bridgeJSRawValue { - case 0: - self = .option1 - case 1: - self = .option2 - default: - return nil - } - } - - private var bridgeJSRawValue: Int32 { - switch self { - case .option1: - return 0 - case .option2: - return 1 - } - } -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_enumProperty_get") -@_cdecl("bjs_StaticPropertyEnum_static_enumProperty_get") -public func _bjs_StaticPropertyEnum_static_enumProperty_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyEnum.enumProperty - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_enumProperty_set") -@_cdecl("bjs_StaticPropertyEnum_static_enumProperty_set") -public func _bjs_StaticPropertyEnum_static_enumProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - StaticPropertyEnum.enumProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_enumConstant_get") -@_cdecl("bjs_StaticPropertyEnum_static_enumConstant_get") -public func _bjs_StaticPropertyEnum_static_enumConstant_get() -> Int32 { - #if arch(wasm32) - let ret = StaticPropertyEnum.enumConstant - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_enumBool_get") -@_cdecl("bjs_StaticPropertyEnum_static_enumBool_get") -public func _bjs_StaticPropertyEnum_static_enumBool_get() -> Int32 { - #if arch(wasm32) - let ret = StaticPropertyEnum.enumBool - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_enumBool_set") -@_cdecl("bjs_StaticPropertyEnum_static_enumBool_set") -public func _bjs_StaticPropertyEnum_static_enumBool_set(_ value: Int32) -> Void { - #if arch(wasm32) - StaticPropertyEnum.enumBool = Bool.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_enumVariable_get") -@_cdecl("bjs_StaticPropertyEnum_static_enumVariable_get") -public func _bjs_StaticPropertyEnum_static_enumVariable_get() -> Int32 { - #if arch(wasm32) - let ret = StaticPropertyEnum.enumVariable - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_enumVariable_set") -@_cdecl("bjs_StaticPropertyEnum_static_enumVariable_set") -public func _bjs_StaticPropertyEnum_static_enumVariable_set(_ value: Int32) -> Void { - #if arch(wasm32) - StaticPropertyEnum.enumVariable = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_computedReadonly_get") -@_cdecl("bjs_StaticPropertyEnum_static_computedReadonly_get") -public func _bjs_StaticPropertyEnum_static_computedReadonly_get() -> Int32 { - #if arch(wasm32) - let ret = StaticPropertyEnum.computedReadonly - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_computedReadWrite_get") -@_cdecl("bjs_StaticPropertyEnum_static_computedReadWrite_get") -public func _bjs_StaticPropertyEnum_static_computedReadWrite_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyEnum.computedReadWrite - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyEnum_static_computedReadWrite_set") -@_cdecl("bjs_StaticPropertyEnum_static_computedReadWrite_set") -public func _bjs_StaticPropertyEnum_static_computedReadWrite_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - StaticPropertyEnum.computedReadWrite = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyNamespace_static_namespaceProperty_get") -@_cdecl("bjs_StaticPropertyNamespace_static_namespaceProperty_get") -public func _bjs_StaticPropertyNamespace_static_namespaceProperty_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyNamespace.namespaceProperty - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyNamespace_static_namespaceProperty_set") -@_cdecl("bjs_StaticPropertyNamespace_static_namespaceProperty_set") -public func _bjs_StaticPropertyNamespace_static_namespaceProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - StaticPropertyNamespace.namespaceProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyNamespace_static_namespaceConstant_get") -@_cdecl("bjs_StaticPropertyNamespace_static_namespaceConstant_get") -public func _bjs_StaticPropertyNamespace_static_namespaceConstant_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyNamespace.namespaceConstant - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_get") -@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_get") -public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_get() -> Int32 { - #if arch(wasm32) - let ret = StaticPropertyNamespace.NestedProperties.nestedProperty - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_set") -@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_set") -public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedProperty_set(_ value: Int32) -> Void { - #if arch(wasm32) - StaticPropertyNamespace.NestedProperties.nestedProperty = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedConstant_get") -@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedConstant_get") -public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedConstant_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyNamespace.NestedProperties.nestedConstant - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_get") -@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_get") -public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_get() -> Float64 { - #if arch(wasm32) - let ret = StaticPropertyNamespace.NestedProperties.nestedDouble - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_set") -@_cdecl("bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_set") -public func _bjs_StaticPropertyNamespace_NestedProperties_static_nestedDouble_set(_ value: Float64) -> Void { - #if arch(wasm32) - StaticPropertyNamespace.NestedProperties.nestedDouble = Double.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt") -public func _bjs_IntegerTypesSupportExports_static_roundTripInt(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripInt(_: Int.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt") -public func _bjs_IntegerTypesSupportExports_static_roundTripUInt(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripUInt(_: UInt.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt8") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt8") -public func _bjs_IntegerTypesSupportExports_static_roundTripInt8(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripInt8(_: Int8.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt8") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt8") -public func _bjs_IntegerTypesSupportExports_static_roundTripUInt8(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripUInt8(_: UInt8.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt16") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt16") -public func _bjs_IntegerTypesSupportExports_static_roundTripInt16(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripInt16(_: Int16.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt16") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt16") -public func _bjs_IntegerTypesSupportExports_static_roundTripUInt16(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripUInt16(_: UInt16.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt32") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt32") -public func _bjs_IntegerTypesSupportExports_static_roundTripInt32(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripInt32(_: Int32.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt32") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt32") -public func _bjs_IntegerTypesSupportExports_static_roundTripUInt32(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripUInt32(_: UInt32.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripInt64") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripInt64") -public func _bjs_IntegerTypesSupportExports_static_roundTripInt64(_ v: Int64) -> Int64 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripInt64(_: Int64.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IntegerTypesSupportExports_static_roundTripUInt64") -@_cdecl("bjs_IntegerTypesSupportExports_static_roundTripUInt64") -public func _bjs_IntegerTypesSupportExports_static_roundTripUInt64(_ v: Int64) -> Int64 { - #if arch(wasm32) - let ret = IntegerTypesSupportExports.roundTripUInt64(_: UInt64.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalString") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalString") -public func _bjs_OptionalSupportExports_static_roundTripOptionalString(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalString(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalInt") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalInt") -public func _bjs_OptionalSupportExports_static_roundTripOptionalInt(_ vIsSome: Int32, _ vValue: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalInt(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalBool") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalBool") -public func _bjs_OptionalSupportExports_static_roundTripOptionalBool(_ vIsSome: Int32, _ vValue: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalBool(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalFloat") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalFloat") -public func _bjs_OptionalSupportExports_static_roundTripOptionalFloat(_ vIsSome: Int32, _ vValue: Float32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalFloat(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalDouble") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalDouble") -public func _bjs_OptionalSupportExports_static_roundTripOptionalDouble(_ vIsSome: Int32, _ vValue: Float64) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalDouble(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalSyntax") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalSyntax") -public func _bjs_OptionalSupportExports_static_roundTripOptionalSyntax(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalSyntax(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum") -public func _bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalCaseEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum") -public func _bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalStringRawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum") -public func _bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalIntRawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum") -public func _bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum(_ vIsSome: Int32, _ vValue: Int64) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalInt64RawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum") -public func _bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum(_ vIsSome: Int32, _ vValue: Int64) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalUInt64RawValueEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTSEnum") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTSEnum") -public func _bjs_OptionalSupportExports_static_roundTripOptionalTSEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalTSEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum") -public func _bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum(_ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalTSStringEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vBytes, vLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum") -public func _bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum(_ vIsSome: Int32, _ vValue: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalNamespacedEnum(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass") -public func _bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass(_ vIsSome: Int32, _ vValue: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalSwiftClass(_: Optional.bridgeJSLiftParameter(vIsSome, vValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalIntArray") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalIntArray") -public func _bjs_OptionalSupportExports_static_roundTripOptionalIntArray() -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalIntArray(_: Optional<[Int]>.bridgeJSLiftParameter()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalStringArray") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalStringArray") -public func _bjs_OptionalSupportExports_static_roundTripOptionalStringArray() -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalStringArray(_: Optional<[String]>.bridgeJSLiftParameter()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray") -public func _bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray() -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalSwiftClassArray(_: Optional<[Greeter]>.bridgeJSLiftParameter()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalAPIResult") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalAPIResult") -public func _bjs_OptionalSupportExports_static_roundTripOptionalAPIResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalAPIResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult") -public func _bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalTypedPayloadResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalComplexResult") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalComplexResult") -public func _bjs_OptionalSupportExports_static_roundTripOptionalComplexResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalComplexResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult") -public func _bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalAllTypesResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult") -public func _bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult(_ v: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalPayloadResult(_: OptionalAllTypesResult.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt") -public func _bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalPayloadResultOpt(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult") -@_cdecl("bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult") -public func _bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult(_ vIsSome: Int32, _ vCaseId: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.roundTripOptionalAPIOptionalResult(_: Optional.bridgeJSLiftParameter(vIsSome, vCaseId)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_takeOptionalJSObject") -@_cdecl("bjs_OptionalSupportExports_static_takeOptionalJSObject") -public func _bjs_OptionalSupportExports_static_takeOptionalJSObject(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - OptionalSupportExports.takeOptionalJSObject(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_applyOptionalGreeter") -@_cdecl("bjs_OptionalSupportExports_static_applyOptionalGreeter") -public func _bjs_OptionalSupportExports_static_applyOptionalGreeter(_ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer, _ transform: Int32) -> Void { - #if arch(wasm32) - let ret = OptionalSupportExports.applyOptionalGreeter(_: Optional.bridgeJSLiftParameter(valueIsSome, valueValue), _: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC.bridgeJSLift(transform)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_makeOptionalHolder") -@_cdecl("bjs_OptionalSupportExports_static_makeOptionalHolder") -public func _bjs_OptionalSupportExports_static_makeOptionalHolder(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = OptionalSupportExports.makeOptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalSupportExports_static_compareAPIResults") -@_cdecl("bjs_OptionalSupportExports_static_compareAPIResults") -public func _bjs_OptionalSupportExports_static_compareAPIResults(_ r1IsSome: Int32, _ r1CaseId: Int32, _ r2IsSome: Int32, _ r2CaseId: Int32) -> Void { - #if arch(wasm32) - let _tmp_r2 = Optional.bridgeJSLiftParameter(r2IsSome, r2CaseId) - let _tmp_r1 = Optional.bridgeJSLiftParameter(r1IsSome, r1CaseId) - let ret = OptionalSupportExports.compareAPIResults(_: _tmp_r1, _: _tmp_r2) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension OptionalAllTypesResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> OptionalAllTypesResult { - switch caseId { - case 0: - return .optStruct(Optional
.bridgeJSStackPop()) - case 1: - return .optClass(Optional.bridgeJSStackPop()) - case 2: - return .optJSObject(Optional.bridgeJSStackPop()) - case 3: - return .optNestedEnum(Optional.bridgeJSStackPop()) - case 4: - return .optArray(Optional<[Int]>.bridgeJSStackPop()) - case 5: - return .optJsClass(Optional.bridgeJSStackPop().map { Foo(unsafelyWrapping: $0) }) - case 6: - return .empty - default: - fatalError("Unknown OptionalAllTypesResult case ID: \(caseId)") - } - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { - switch self { - case .optStruct(let param0): - param0.bridgeJSStackPush() - return Int32(0) - case .optClass(let param0): - param0.bridgeJSStackPush() - return Int32(1) - case .optJSObject(let param0): - param0.bridgeJSStackPush() - return Int32(2) - case .optNestedEnum(let param0): - param0.bridgeJSStackPush() - return Int32(3) - case .optArray(let param0): - param0.bridgeJSStackPush() - return Int32(4) - case .optJsClass(let param0): - param0.bridgeJSStackPush() - return Int32(5) - case .empty: - return Int32(6) - } - } -} - -extension APIOptionalResult: _BridgedSwiftAssociatedValueEnum { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPopPayload(_ caseId: Int32) -> APIOptionalResult { - switch caseId { - case 0: - return .success(Optional.bridgeJSStackPop()) - case 1: - return .failure(Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop()) - case 2: - return .status(Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop(), Optional.bridgeJSStackPop()) - default: - fatalError("Unknown APIOptionalResult case ID: \(caseId)") - } - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPushPayload() -> Int32 { - switch self { - case .success(let param0): - param0.bridgeJSStackPush() - return Int32(0) - case .failure(let param0, let param1): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - return Int32(1) - case .status(let param0, let param1, let param2): - param0.bridgeJSStackPush() - param1.bridgeJSStackPush() - param2.bridgeJSStackPush() - return Int32(2) - } - } -} - -extension Point: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Point { - let y = Int.bridgeJSStackPop() - let x = Int.bridgeJSStackPop() - return Point(x: x, y: y) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.x.bridgeJSStackPush() - self.y.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_Point(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Point())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Point") -fileprivate func _bjs_struct_lower_Point_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_Point_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_Point(_ objectId: Int32) -> Void { - return _bjs_struct_lower_Point_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Point") -fileprivate func _bjs_struct_lift_Point_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_Point_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_Point() -> Int32 { - return _bjs_struct_lift_Point_extern() -} - -extension PointerFields: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> PointerFields { - let mutPtr = UnsafeMutablePointer.bridgeJSStackPop() - let ptr = UnsafePointer.bridgeJSStackPop() - let opaque = OpaquePointer.bridgeJSStackPop() - let mutRaw = UnsafeMutableRawPointer.bridgeJSStackPop() - let raw = UnsafeRawPointer.bridgeJSStackPop() - return PointerFields(raw: raw, mutRaw: mutRaw, opaque: opaque, ptr: ptr, mutPtr: mutPtr) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.raw.bridgeJSStackPush() - self.mutRaw.bridgeJSStackPush() - self.opaque.bridgeJSStackPush() - self.ptr.bridgeJSStackPush() - self.mutPtr.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_PointerFields(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PointerFields())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PointerFields") -fileprivate func _bjs_struct_lower_PointerFields_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_PointerFields_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_PointerFields(_ objectId: Int32) -> Void { - return _bjs_struct_lower_PointerFields_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PointerFields") -fileprivate func _bjs_struct_lift_PointerFields_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_PointerFields_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_PointerFields() -> Int32 { - return _bjs_struct_lift_PointerFields_extern() -} - -@_expose(wasm, "bjs_PointerFields_init") -@_cdecl("bjs_PointerFields_init") -public func _bjs_PointerFields_init(_ raw: UnsafeMutableRawPointer, _ mutRaw: UnsafeMutableRawPointer, _ opaque: UnsafeMutableRawPointer, _ ptr: UnsafeMutableRawPointer, _ mutPtr: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PointerFields(raw: UnsafeRawPointer.bridgeJSLiftParameter(raw), mutRaw: UnsafeMutableRawPointer.bridgeJSLiftParameter(mutRaw), opaque: OpaquePointer.bridgeJSLiftParameter(opaque), ptr: UnsafePointer.bridgeJSLiftParameter(ptr), mutPtr: UnsafeMutablePointer.bridgeJSLiftParameter(mutPtr)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension DataPoint: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> DataPoint { - let optFlag = Optional.bridgeJSStackPop() - let optCount = Optional.bridgeJSStackPop() - let label = String.bridgeJSStackPop() - let y = Double.bridgeJSStackPop() - let x = Double.bridgeJSStackPop() - return DataPoint(x: x, y: y, label: label, optCount: optCount, optFlag: optFlag) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.x.bridgeJSStackPush() - self.y.bridgeJSStackPush() - self.label.bridgeJSStackPush() - self.optCount.bridgeJSStackPush() - self.optFlag.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_DataPoint(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_DataPoint())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_DataPoint") -fileprivate func _bjs_struct_lower_DataPoint_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_DataPoint_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_DataPoint(_ objectId: Int32) -> Void { - return _bjs_struct_lower_DataPoint_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_DataPoint") -fileprivate func _bjs_struct_lift_DataPoint_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_DataPoint_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_DataPoint() -> Int32 { - return _bjs_struct_lift_DataPoint_extern() -} - -@_expose(wasm, "bjs_DataPoint_init") -@_cdecl("bjs_DataPoint_init") -public func _bjs_DataPoint_init(_ x: Float64, _ y: Float64, _ labelBytes: Int32, _ labelLength: Int32, _ optCountIsSome: Int32, _ optCountValue: Int32, _ optFlagIsSome: Int32, _ optFlagValue: Int32) -> Void { - #if arch(wasm32) - let ret = DataPoint(x: Double.bridgeJSLiftParameter(x), y: Double.bridgeJSLiftParameter(y), label: String.bridgeJSLiftParameter(labelBytes, labelLength), optCount: Optional.bridgeJSLiftParameter(optCountIsSome, optCountValue), optFlag: Optional.bridgeJSLiftParameter(optFlagIsSome, optFlagValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataPoint_static_dimensions_get") -@_cdecl("bjs_DataPoint_static_dimensions_get") -public func _bjs_DataPoint_static_dimensions_get() -> Int32 { - #if arch(wasm32) - let ret = DataPoint.dimensions - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataPoint_static_origin") -@_cdecl("bjs_DataPoint_static_origin") -public func _bjs_DataPoint_static_origin() -> Void { - #if arch(wasm32) - let ret = DataPoint.origin() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension PublicPoint: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> PublicPoint { - let y = Int.bridgeJSStackPop() - let x = Int.bridgeJSStackPop() - return PublicPoint(x: x, y: y) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.x.bridgeJSStackPush() - self.y.bridgeJSStackPush() - } - - public init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_PublicPoint(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - public func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_PublicPoint())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_PublicPoint") -fileprivate func _bjs_struct_lower_PublicPoint_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_PublicPoint_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_PublicPoint(_ objectId: Int32) -> Void { - return _bjs_struct_lower_PublicPoint_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_PublicPoint") -fileprivate func _bjs_struct_lift_PublicPoint_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_PublicPoint_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_PublicPoint() -> Int32 { - return _bjs_struct_lift_PublicPoint_extern() -} - -@_expose(wasm, "bjs_PublicPoint_init") -@_cdecl("bjs_PublicPoint_init") -public func _bjs_PublicPoint_init(_ x: Int32, _ y: Int32) -> Void { - #if arch(wasm32) - let ret = PublicPoint(x: Int.bridgeJSLiftParameter(x), y: Int.bridgeJSLiftParameter(y)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Address: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Address { - let zipCode = Optional.bridgeJSStackPop() - let city = String.bridgeJSStackPop() - let street = String.bridgeJSStackPop() - return Address(street: street, city: city, zipCode: zipCode) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.street.bridgeJSStackPush() - self.city.bridgeJSStackPush() - self.zipCode.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_Address(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Address())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Address") -fileprivate func _bjs_struct_lower_Address_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_Address_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Void { - return _bjs_struct_lower_Address_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Address") -fileprivate func _bjs_struct_lift_Address_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_Address_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_Address() -> Int32 { - return _bjs_struct_lift_Address_extern() -} - -extension Contact: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Contact { - let secondaryAddress = Optional
.bridgeJSStackPop() - let email = Optional.bridgeJSStackPop() - let address = Address.bridgeJSStackPop() - let age = Int.bridgeJSStackPop() - let name = String.bridgeJSStackPop() - return Contact(name: name, age: age, address: address, email: email, secondaryAddress: secondaryAddress) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.name.bridgeJSStackPush() - self.age.bridgeJSStackPush() - self.address.bridgeJSStackPush() - self.email.bridgeJSStackPush() - self.secondaryAddress.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_Contact(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Contact())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Contact") -fileprivate func _bjs_struct_lower_Contact_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_Contact_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_Contact(_ objectId: Int32) -> Void { - return _bjs_struct_lower_Contact_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Contact") -fileprivate func _bjs_struct_lift_Contact_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_Contact_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_Contact() -> Int32 { - return _bjs_struct_lift_Contact_extern() -} - -extension Config: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Config { - let status = Status.bridgeJSStackPop() - let direction = Optional.bridgeJSStackPop() - let theme = Optional.bridgeJSStackPop() - let name = String.bridgeJSStackPop() - return Config(name: name, theme: theme, direction: direction, status: status) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.name.bridgeJSStackPush() - self.theme.bridgeJSStackPush() - self.direction.bridgeJSStackPush() - self.status.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_Config(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Config())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Config") -fileprivate func _bjs_struct_lower_Config_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_Config_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_Config(_ objectId: Int32) -> Void { - return _bjs_struct_lower_Config_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Config") -fileprivate func _bjs_struct_lift_Config_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_Config_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_Config() -> Int32 { - return _bjs_struct_lift_Config_extern() -} - -extension SessionData: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> SessionData { - let owner = Optional.bridgeJSStackPop() - let id = Int.bridgeJSStackPop() - return SessionData(id: id, owner: owner) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.id.bridgeJSStackPush() - self.owner.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_SessionData(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_SessionData())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_SessionData") -fileprivate func _bjs_struct_lower_SessionData_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_SessionData_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_SessionData(_ objectId: Int32) -> Void { - return _bjs_struct_lower_SessionData_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_SessionData") -fileprivate func _bjs_struct_lift_SessionData_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_SessionData_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_SessionData() -> Int32 { - return _bjs_struct_lift_SessionData_extern() -} - -extension ValidationReport: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ValidationReport { - let outcome = Optional.bridgeJSStackPop() - let status = Optional.bridgeJSStackPop() - let result = APIResult.bridgeJSStackPop() - let id = Int.bridgeJSStackPop() - return ValidationReport(id: id, result: result, status: status, outcome: outcome) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.id.bridgeJSStackPush() - self.result.bridgeJSStackPush() - self.status.bridgeJSStackPush() - self.outcome.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_ValidationReport(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ValidationReport())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ValidationReport") -fileprivate func _bjs_struct_lower_ValidationReport_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_ValidationReport_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_ValidationReport(_ objectId: Int32) -> Void { - return _bjs_struct_lower_ValidationReport_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ValidationReport") -fileprivate func _bjs_struct_lift_ValidationReport_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_ValidationReport_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_ValidationReport() -> Int32 { - return _bjs_struct_lift_ValidationReport_extern() -} - -extension AdvancedConfig: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> AdvancedConfig { - let overrideDefaults = Optional.bridgeJSStackPop() - let defaults = ConfigStruct.bridgeJSStackPop() - let location = Optional.bridgeJSStackPop() - let metadata = Optional.bridgeJSStackPop() - let result = Optional.bridgeJSStackPop() - let status = Status.bridgeJSStackPop() - let theme = Theme.bridgeJSStackPop() - let enabled = Bool.bridgeJSStackPop() - let title = String.bridgeJSStackPop() - let id = Int.bridgeJSStackPop() - return AdvancedConfig(id: id, title: title, enabled: enabled, theme: theme, status: status, result: result, metadata: metadata, location: location, defaults: defaults, overrideDefaults: overrideDefaults) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.id.bridgeJSStackPush() - self.title.bridgeJSStackPush() - self.enabled.bridgeJSStackPush() - self.theme.bridgeJSStackPush() - self.status.bridgeJSStackPush() - self.result.bridgeJSStackPush() - self.metadata.bridgeJSStackPush() - self.location.bridgeJSStackPush() - self.defaults.bridgeJSStackPush() - self.overrideDefaults.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_AdvancedConfig(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_AdvancedConfig())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_AdvancedConfig") -fileprivate func _bjs_struct_lower_AdvancedConfig_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_AdvancedConfig_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_AdvancedConfig(_ objectId: Int32) -> Void { - return _bjs_struct_lower_AdvancedConfig_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_AdvancedConfig") -fileprivate func _bjs_struct_lift_AdvancedConfig_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_AdvancedConfig_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_AdvancedConfig() -> Int32 { - return _bjs_struct_lift_AdvancedConfig_extern() -} - -extension MeasurementConfig: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> MeasurementConfig { - let optionalRatio = Optional.bridgeJSStackPop() - let optionalPrecision = Optional.bridgeJSStackPop() - let ratio = Ratio.bridgeJSStackPop() - let precision = Precision.bridgeJSStackPop() - return MeasurementConfig(precision: precision, ratio: ratio, optionalPrecision: optionalPrecision, optionalRatio: optionalRatio) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.precision.bridgeJSStackPush() - self.ratio.bridgeJSStackPush() - self.optionalPrecision.bridgeJSStackPush() - self.optionalRatio.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_MeasurementConfig(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MeasurementConfig())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MeasurementConfig") -fileprivate func _bjs_struct_lower_MeasurementConfig_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_MeasurementConfig_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_MeasurementConfig(_ objectId: Int32) -> Void { - return _bjs_struct_lower_MeasurementConfig_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_MeasurementConfig") -fileprivate func _bjs_struct_lift_MeasurementConfig_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_MeasurementConfig_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_MeasurementConfig() -> Int32 { - return _bjs_struct_lift_MeasurementConfig_extern() -} - -extension MathOperations: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> MathOperations { - let baseValue = Double.bridgeJSStackPop() - return MathOperations(baseValue: baseValue) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.baseValue.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_MathOperations(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_MathOperations())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_MathOperations") -fileprivate func _bjs_struct_lower_MathOperations_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_MathOperations_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_MathOperations(_ objectId: Int32) -> Void { - return _bjs_struct_lower_MathOperations_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_MathOperations") -fileprivate func _bjs_struct_lift_MathOperations_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_MathOperations_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_MathOperations() -> Int32 { - return _bjs_struct_lift_MathOperations_extern() -} - -@_expose(wasm, "bjs_MathOperations_init") -@_cdecl("bjs_MathOperations_init") -public func _bjs_MathOperations_init(_ baseValue: Float64) -> Void { - #if arch(wasm32) - let ret = MathOperations(baseValue: Double.bridgeJSLiftParameter(baseValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_MathOperations_add") -@_cdecl("bjs_MathOperations_add") -public func _bjs_MathOperations_add(_ a: Float64, _ b: Float64) -> Float64 { - #if arch(wasm32) - let ret = MathOperations.bridgeJSLiftParameter().add(a: Double.bridgeJSLiftParameter(a), b: Double.bridgeJSLiftParameter(b)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_MathOperations_multiply") -@_cdecl("bjs_MathOperations_multiply") -public func _bjs_MathOperations_multiply(_ a: Float64, _ b: Float64) -> Float64 { - #if arch(wasm32) - let ret = MathOperations.bridgeJSLiftParameter().multiply(a: Double.bridgeJSLiftParameter(a), b: Double.bridgeJSLiftParameter(b)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_MathOperations_static_subtract") -@_cdecl("bjs_MathOperations_static_subtract") -public func _bjs_MathOperations_static_subtract(_ a: Float64, _ b: Float64) -> Float64 { - #if arch(wasm32) - let ret = MathOperations.subtract(a: Double.bridgeJSLiftParameter(a), b: Double.bridgeJSLiftParameter(b)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension CopyableCart: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> CopyableCart { - let note = Optional.bridgeJSStackPop() - let x = Int.bridgeJSStackPop() - return CopyableCart(x: x, note: note) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.x.bridgeJSStackPush() - self.note.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_CopyableCart(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableCart())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCart") -fileprivate func _bjs_struct_lower_CopyableCart_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_CopyableCart_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_CopyableCart(_ objectId: Int32) -> Void { - return _bjs_struct_lower_CopyableCart_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_CopyableCart") -fileprivate func _bjs_struct_lift_CopyableCart_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_CopyableCart_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_CopyableCart() -> Int32 { - return _bjs_struct_lift_CopyableCart_extern() -} - -@_expose(wasm, "bjs_CopyableCart_static_fromJSObject") -@_cdecl("bjs_CopyableCart_static_fromJSObject") -public func _bjs_CopyableCart_static_fromJSObject(_ object: Int32) -> Void { - #if arch(wasm32) - let ret = CopyableCart.fromJSObject(_: JSObject.bridgeJSLiftParameter(object)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension CopyableCartItem: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> CopyableCartItem { - let quantity = Int.bridgeJSStackPop() - let sku = String.bridgeJSStackPop() - return CopyableCartItem(sku: sku, quantity: quantity) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.sku.bridgeJSStackPush() - self.quantity.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_CopyableCartItem(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableCartItem())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableCartItem") -fileprivate func _bjs_struct_lower_CopyableCartItem_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_CopyableCartItem_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_CopyableCartItem(_ objectId: Int32) -> Void { - return _bjs_struct_lower_CopyableCartItem_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_CopyableCartItem") -fileprivate func _bjs_struct_lift_CopyableCartItem_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_CopyableCartItem_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_CopyableCartItem() -> Int32 { - return _bjs_struct_lift_CopyableCartItem_extern() -} - -extension CopyableNestedCart: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> CopyableNestedCart { - let shippingAddress = Optional
.bridgeJSStackPop() - let item = CopyableCartItem.bridgeJSStackPop() - let id = Int.bridgeJSStackPop() - return CopyableNestedCart(id: id, item: item, shippingAddress: shippingAddress) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.id.bridgeJSStackPush() - self.item.bridgeJSStackPush() - self.shippingAddress.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_CopyableNestedCart(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_CopyableNestedCart())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_CopyableNestedCart") -fileprivate func _bjs_struct_lower_CopyableNestedCart_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_CopyableNestedCart_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_CopyableNestedCart(_ objectId: Int32) -> Void { - return _bjs_struct_lower_CopyableNestedCart_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_CopyableNestedCart") -fileprivate func _bjs_struct_lift_CopyableNestedCart_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_CopyableNestedCart_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_CopyableNestedCart() -> Int32 { - return _bjs_struct_lift_CopyableNestedCart_extern() -} - -@_expose(wasm, "bjs_CopyableNestedCart_static_fromJSObject") -@_cdecl("bjs_CopyableNestedCart_static_fromJSObject") -public func _bjs_CopyableNestedCart_static_fromJSObject(_ object: Int32) -> Void { - #if arch(wasm32) - let ret = CopyableNestedCart.fromJSObject(_: JSObject.bridgeJSLiftParameter(object)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension ConfigStruct: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ConfigStruct { - let value = Int.bridgeJSStackPop() - let name = String.bridgeJSStackPop() - return ConfigStruct(name: name, value: value) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.name.bridgeJSStackPush() - self.value.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_ConfigStruct(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ConfigStruct())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ConfigStruct") -fileprivate func _bjs_struct_lower_ConfigStruct_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_ConfigStruct_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_ConfigStruct(_ objectId: Int32) -> Void { - return _bjs_struct_lower_ConfigStruct_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ConfigStruct") -fileprivate func _bjs_struct_lift_ConfigStruct_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_ConfigStruct_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_ConfigStruct() -> Int32 { - return _bjs_struct_lift_ConfigStruct_extern() -} - -@_expose(wasm, "bjs_ConfigStruct_static_defaultConfig_get") -@_cdecl("bjs_ConfigStruct_static_defaultConfig_get") -public func _bjs_ConfigStruct_static_defaultConfig_get() -> Void { - #if arch(wasm32) - let ret = ConfigStruct.defaultConfig - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ConfigStruct_static_defaultConfig_set") -@_cdecl("bjs_ConfigStruct_static_defaultConfig_set") -public func _bjs_ConfigStruct_static_defaultConfig_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - ConfigStruct.defaultConfig = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ConfigStruct_static_maxRetries_get") -@_cdecl("bjs_ConfigStruct_static_maxRetries_get") -public func _bjs_ConfigStruct_static_maxRetries_get() -> Int32 { - #if arch(wasm32) - let ret = ConfigStruct.maxRetries - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ConfigStruct_static_timeout_get") -@_cdecl("bjs_ConfigStruct_static_timeout_get") -public func _bjs_ConfigStruct_static_timeout_get() -> Float64 { - #if arch(wasm32) - let ret = ConfigStruct.timeout - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ConfigStruct_static_timeout_set") -@_cdecl("bjs_ConfigStruct_static_timeout_set") -public func _bjs_ConfigStruct_static_timeout_set(_ value: Float64) -> Void { - #if arch(wasm32) - ConfigStruct.timeout = Double.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ConfigStruct_static_computedSetting_get") -@_cdecl("bjs_ConfigStruct_static_computedSetting_get") -public func _bjs_ConfigStruct_static_computedSetting_get() -> Void { - #if arch(wasm32) - let ret = ConfigStruct.computedSetting - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Vector2D: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Vector2D { - let dy = Double.bridgeJSStackPop() - let dx = Double.bridgeJSStackPop() - return Vector2D(dx: dx, dy: dy) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.dx.bridgeJSStackPush() - self.dy.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_Vector2D(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Vector2D())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_Vector2D") -fileprivate func _bjs_struct_lower_Vector2D_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_Vector2D_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_Vector2D(_ objectId: Int32) -> Void { - return _bjs_struct_lower_Vector2D_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Vector2D") -fileprivate func _bjs_struct_lift_Vector2D_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_Vector2D_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_Vector2D() -> Int32 { - return _bjs_struct_lift_Vector2D_extern() -} - -@_expose(wasm, "bjs_Vector2D_init") -@_cdecl("bjs_Vector2D_init") -public func _bjs_Vector2D_init(_ dx: Float64, _ dy: Float64) -> Void { - #if arch(wasm32) - let ret = Vector2D(dx: Double.bridgeJSLiftParameter(dx), dy: Double.bridgeJSLiftParameter(dy)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Vector2D_magnitude") -@_cdecl("bjs_Vector2D_magnitude") -public func _bjs_Vector2D_magnitude() -> Float64 { - #if arch(wasm32) - let ret = Vector2D.bridgeJSLiftParameter().magnitude() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Vector2D_scaled") -@_cdecl("bjs_Vector2D_scaled") -public func _bjs_Vector2D_scaled(_ factor: Float64) -> Void { - #if arch(wasm32) - let ret = Vector2D.bridgeJSLiftParameter().scaled(by: Double.bridgeJSLiftParameter(factor)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension JSObjectContainer: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> JSObjectContainer { - let optionalObject = Optional.bridgeJSStackPop() - let object = JSObject.bridgeJSStackPop() - return JSObjectContainer(object: object, optionalObject: optionalObject) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.object.bridgeJSStackPush() - self.optionalObject.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_JSObjectContainer(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_JSObjectContainer())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_JSObjectContainer") -fileprivate func _bjs_struct_lower_JSObjectContainer_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_JSObjectContainer_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_JSObjectContainer(_ objectId: Int32) -> Void { - return _bjs_struct_lower_JSObjectContainer_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_JSObjectContainer") -fileprivate func _bjs_struct_lift_JSObjectContainer_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_JSObjectContainer_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_JSObjectContainer() -> Int32 { - return _bjs_struct_lift_JSObjectContainer_extern() -} - -extension FooContainer: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> FooContainer { - let optionalFoo = Optional.bridgeJSStackPop().map { Foo(unsafelyWrapping: $0) } - let foo = Foo(unsafelyWrapping: JSObject.bridgeJSStackPop()) - return FooContainer(foo: foo, optionalFoo: optionalFoo) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.foo.jsObject.bridgeJSStackPush() - self.optionalFoo.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_FooContainer(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_FooContainer())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_FooContainer") -fileprivate func _bjs_struct_lower_FooContainer_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_FooContainer_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_FooContainer(_ objectId: Int32) -> Void { - return _bjs_struct_lower_FooContainer_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_FooContainer") -fileprivate func _bjs_struct_lift_FooContainer_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_FooContainer_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_FooContainer() -> Int32 { - return _bjs_struct_lift_FooContainer_extern() -} - -extension ArrayMembers: _BridgedSwiftStruct { - @_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> ArrayMembers { - let optStrings = Optional<[String]>.bridgeJSStackPop() - let ints = [Int].bridgeJSStackPop() - return ArrayMembers(ints: ints, optStrings: optStrings) - } - - @_spi(BridgeJS) @_transparent public consuming func bridgeJSStackPush() { - self.ints.bridgeJSStackPush() - self.optStrings.bridgeJSStackPush() - } - - init(unsafelyCopying jsObject: JSObject) { - _bjs_struct_lower_ArrayMembers(jsObject.bridgeJSLowerParameter()) - self = Self.bridgeJSStackPop() - } - - func toJSObject() -> JSObject { - let __bjs_self = self - __bjs_self.bridgeJSStackPush() - return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ArrayMembers())) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lower_ArrayMembers") -fileprivate func _bjs_struct_lower_ArrayMembers_extern(_ objectId: Int32) -> Void -#else -fileprivate func _bjs_struct_lower_ArrayMembers_extern(_ objectId: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lower_ArrayMembers(_ objectId: Int32) -> Void { - return _bjs_struct_lower_ArrayMembers_extern(objectId) -} - -#if arch(wasm32) -@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ArrayMembers") -fileprivate func _bjs_struct_lift_ArrayMembers_extern() -> Int32 -#else -fileprivate func _bjs_struct_lift_ArrayMembers_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_struct_lift_ArrayMembers() -> Int32 { - return _bjs_struct_lift_ArrayMembers_extern() -} - -@_expose(wasm, "bjs_ArrayMembers_sumValues") -@_cdecl("bjs_ArrayMembers_sumValues") -public func _bjs_ArrayMembers_sumValues() -> Int32 { - #if arch(wasm32) - let ret = ArrayMembers.bridgeJSLiftParameter().sumValues(_: [Int].bridgeJSStackPop()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArrayMembers_firstString") -@_cdecl("bjs_ArrayMembers_firstString") -public func _bjs_ArrayMembers_firstString() -> Void { - #if arch(wasm32) - let ret = ArrayMembers.bridgeJSLiftParameter().firstString(_: [String].bridgeJSStackPop()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripVoid") -@_cdecl("bjs_roundTripVoid") -public func _bjs_roundTripVoid() -> Void { - #if arch(wasm32) - roundTripVoid() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripFloat") -@_cdecl("bjs_roundTripFloat") -public func _bjs_roundTripFloat(_ v: Float32) -> Float32 { - #if arch(wasm32) - let ret = roundTripFloat(v: Float.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripDouble") -@_cdecl("bjs_roundTripDouble") -public func _bjs_roundTripDouble(_ v: Float64) -> Float64 { - #if arch(wasm32) - let ret = roundTripDouble(v: Double.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripBool") -@_cdecl("bjs_roundTripBool") -public func _bjs_roundTripBool(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = roundTripBool(v: Bool.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripString") -@_cdecl("bjs_roundTripString") -public func _bjs_roundTripString(_ vBytes: Int32, _ vLength: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripString(v: String.bridgeJSLiftParameter(vBytes, vLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripSwiftHeapObject") -@_cdecl("bjs_roundTripSwiftHeapObject") -public func _bjs_roundTripSwiftHeapObject(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = roundTripSwiftHeapObject(v: Greeter.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripUnsafeRawPointer") -@_cdecl("bjs_roundTripUnsafeRawPointer") -public func _bjs_roundTripUnsafeRawPointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = roundTripUnsafeRawPointer(v: UnsafeRawPointer.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripUnsafeMutableRawPointer") -@_cdecl("bjs_roundTripUnsafeMutableRawPointer") -public func _bjs_roundTripUnsafeMutableRawPointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = roundTripUnsafeMutableRawPointer(v: UnsafeMutableRawPointer.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOpaquePointer") -@_cdecl("bjs_roundTripOpaquePointer") -public func _bjs_roundTripOpaquePointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = roundTripOpaquePointer(v: OpaquePointer.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripUnsafePointer") -@_cdecl("bjs_roundTripUnsafePointer") -public func _bjs_roundTripUnsafePointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = roundTripUnsafePointer(v: UnsafePointer.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripUnsafeMutablePointer") -@_cdecl("bjs_roundTripUnsafeMutablePointer") -public func _bjs_roundTripUnsafeMutablePointer(_ v: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = roundTripUnsafeMutablePointer(v: UnsafeMutablePointer.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripJSObject") -@_cdecl("bjs_roundTripJSObject") -public func _bjs_roundTripJSObject(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = roundTripJSObject(v: JSObject.bridgeJSLiftParameter(v)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripDictionaryExport") -@_cdecl("bjs_roundTripDictionaryExport") -public func _bjs_roundTripDictionaryExport() -> Void { - #if arch(wasm32) - let ret = roundTripDictionaryExport(v: [String: Int].bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalDictionaryExport") -@_cdecl("bjs_roundTripOptionalDictionaryExport") -public func _bjs_roundTripOptionalDictionaryExport() -> Void { - #if arch(wasm32) - let ret = roundTripOptionalDictionaryExport(v: Optional<[String: String]>.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripJSValue") -@_cdecl("bjs_roundTripJSValue") -public func _bjs_roundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { - #if arch(wasm32) - let ret = roundTripJSValue(v: JSValue.bridgeJSLiftParameter(vKind, vPayload1, vPayload2)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalJSValue") -@_cdecl("bjs_roundTripOptionalJSValue") -public func _bjs_roundTripOptionalJSValue(_ vIsSome: Int32, _ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { - #if arch(wasm32) - let ret = roundTripOptionalJSValue(v: Optional.bridgeJSLiftParameter(vIsSome, vKind, vPayload1, vPayload2)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripOptionalJSValueArray") -@_cdecl("bjs_roundTripOptionalJSValueArray") -public func _bjs_roundTripOptionalJSValueArray() -> Void { - #if arch(wasm32) - let ret = roundTripOptionalJSValueArray(v: Optional<[JSValue]>.bridgeJSLiftParameter()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeImportedFoo") -@_cdecl("bjs_makeImportedFoo") -public func _bjs_makeImportedFoo(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { - #if arch(wasm32) - do { - let ret = try makeImportedFoo(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) - return ret.bridgeJSLowerReturn() - } catch let error { - if let error = error.thrownValue.object { - withExtendedLifetime(error) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } else { - let jsError = JSError(message: String(describing: error)) - withExtendedLifetime(jsError.jsObject) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } - return 0 - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_throwsSwiftError") -@_cdecl("bjs_throwsSwiftError") -public func _bjs_throwsSwiftError(_ shouldThrow: Int32) -> Void { - #if arch(wasm32) - do { - try throwsSwiftError(shouldThrow: Bool.bridgeJSLiftParameter(shouldThrow)) - } catch let error { - if let error = error.thrownValue.object { - withExtendedLifetime(error) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } else { - let jsError = JSError(message: String(describing: error)) - withExtendedLifetime(jsError.jsObject) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } - return - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_throwsWithIntResult") -@_cdecl("bjs_throwsWithIntResult") -public func _bjs_throwsWithIntResult() -> Int32 { - #if arch(wasm32) - do { - let ret = try throwsWithIntResult() - return ret.bridgeJSLowerReturn() - } catch let error { - if let error = error.thrownValue.object { - withExtendedLifetime(error) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } else { - let jsError = JSError(message: String(describing: error)) - withExtendedLifetime(jsError.jsObject) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } - return 0 - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_throwsWithStringResult") -@_cdecl("bjs_throwsWithStringResult") -public func _bjs_throwsWithStringResult() -> Void { - #if arch(wasm32) - do { - let ret = try throwsWithStringResult() - return ret.bridgeJSLowerReturn() - } catch let error { - if let error = error.thrownValue.object { - withExtendedLifetime(error) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } else { - let jsError = JSError(message: String(describing: error)) - withExtendedLifetime(jsError.jsObject) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } - return - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_throwsWithBoolResult") -@_cdecl("bjs_throwsWithBoolResult") -public func _bjs_throwsWithBoolResult() -> Int32 { - #if arch(wasm32) - do { - let ret = try throwsWithBoolResult() - return ret.bridgeJSLowerReturn() - } catch let error { - if let error = error.thrownValue.object { - withExtendedLifetime(error) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } else { - let jsError = JSError(message: String(describing: error)) - withExtendedLifetime(jsError.jsObject) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } - return 0 - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_throwsWithFloatResult") -@_cdecl("bjs_throwsWithFloatResult") -public func _bjs_throwsWithFloatResult() -> Float32 { - #if arch(wasm32) - do { - let ret = try throwsWithFloatResult() - return ret.bridgeJSLowerReturn() - } catch let error { - if let error = error.thrownValue.object { - withExtendedLifetime(error) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } else { - let jsError = JSError(message: String(describing: error)) - withExtendedLifetime(jsError.jsObject) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } - return 0.0 - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_throwsWithDoubleResult") -@_cdecl("bjs_throwsWithDoubleResult") -public func _bjs_throwsWithDoubleResult() -> Float64 { - #if arch(wasm32) - do { - let ret = try throwsWithDoubleResult() - return ret.bridgeJSLowerReturn() - } catch let error { - if let error = error.thrownValue.object { - withExtendedLifetime(error) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } else { - let jsError = JSError(message: String(describing: error)) - withExtendedLifetime(jsError.jsObject) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } - return 0.0 - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_throwsWithSwiftHeapObjectResult") -@_cdecl("bjs_throwsWithSwiftHeapObjectResult") -public func _bjs_throwsWithSwiftHeapObjectResult() -> UnsafeMutableRawPointer { - #if arch(wasm32) - do { - let ret = try throwsWithSwiftHeapObjectResult() - return ret.bridgeJSLowerReturn() - } catch let error { - if let error = error.thrownValue.object { - withExtendedLifetime(error) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } else { - let jsError = JSError(message: String(describing: error)) - withExtendedLifetime(jsError.jsObject) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } - return UnsafeMutableRawPointer(bitPattern: -1).unsafelyUnwrapped - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_throwsWithJSObjectResult") -@_cdecl("bjs_throwsWithJSObjectResult") -public func _bjs_throwsWithJSObjectResult() -> Int32 { - #if arch(wasm32) - do { - let ret = try throwsWithJSObjectResult() - return ret.bridgeJSLowerReturn() - } catch let error { - if let error = error.thrownValue.object { - withExtendedLifetime(error) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } else { - let jsError = JSError(message: String(describing: error)) - withExtendedLifetime(jsError.jsObject) { - _swift_js_throw(Int32(bitPattern: $0.id)) - } - } - return 0 - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_asyncRoundTripVoid") -@_cdecl("bjs_asyncRoundTripVoid") -public func _bjs_asyncRoundTripVoid() -> Int32 { - #if arch(wasm32) - let ret = JSPromise.async { - await asyncRoundTripVoid() - }.jsObject - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_asyncRoundTripInt") -@_cdecl("bjs_asyncRoundTripInt") -public func _bjs_asyncRoundTripInt(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = JSPromise.async { - return await asyncRoundTripInt(v: Int.bridgeJSLiftParameter(v)).jsValue - }.jsObject - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_asyncRoundTripFloat") -@_cdecl("bjs_asyncRoundTripFloat") -public func _bjs_asyncRoundTripFloat(_ v: Float32) -> Int32 { - #if arch(wasm32) - let ret = JSPromise.async { - return await asyncRoundTripFloat(v: Float.bridgeJSLiftParameter(v)).jsValue - }.jsObject - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_asyncRoundTripDouble") -@_cdecl("bjs_asyncRoundTripDouble") -public func _bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { - #if arch(wasm32) - let ret = JSPromise.async { - return await asyncRoundTripDouble(v: Double.bridgeJSLiftParameter(v)).jsValue - }.jsObject - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_asyncRoundTripBool") -@_cdecl("bjs_asyncRoundTripBool") -public func _bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = JSPromise.async { - return await asyncRoundTripBool(v: Bool.bridgeJSLiftParameter(v)).jsValue - }.jsObject - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_asyncRoundTripString") -@_cdecl("bjs_asyncRoundTripString") -public func _bjs_asyncRoundTripString(_ vBytes: Int32, _ vLength: Int32) -> Int32 { - #if arch(wasm32) - let ret = JSPromise.async { - return await asyncRoundTripString(v: String.bridgeJSLiftParameter(vBytes, vLength)).jsValue - }.jsObject - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_asyncRoundTripSwiftHeapObject") -@_cdecl("bjs_asyncRoundTripSwiftHeapObject") -public func _bjs_asyncRoundTripSwiftHeapObject(_ v: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = JSPromise.async { - return await asyncRoundTripSwiftHeapObject(v: Greeter.bridgeJSLiftParameter(v)).jsValue - }.jsObject - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_asyncRoundTripJSObject") -@_cdecl("bjs_asyncRoundTripJSObject") -public func _bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { - #if arch(wasm32) - let ret = JSPromise.async { - return await asyncRoundTripJSObject(v: JSObject.bridgeJSLiftParameter(v)).jsValue - }.jsObject - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_takeGreeter") -@_cdecl("bjs_takeGreeter") -public func _bjs_takeGreeter(_ g: UnsafeMutableRawPointer, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - #if arch(wasm32) - takeGreeter(g: Greeter.bridgeJSLiftParameter(g), name: String.bridgeJSLiftParameter(nameBytes, nameLength)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_createCalculator") -@_cdecl("bjs_createCalculator") -public func _bjs_createCalculator() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = createCalculator() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_useCalculator") -@_cdecl("bjs_useCalculator") -public func _bjs_useCalculator(_ calc: UnsafeMutableRawPointer, _ x: Int32, _ y: Int32) -> Int32 { - #if arch(wasm32) - let ret = useCalculator(calc: Calculator.bridgeJSLiftParameter(calc), x: Int.bridgeJSLiftParameter(x), y: Int.bridgeJSLiftParameter(y)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_testGreeterToJSValue") -@_cdecl("bjs_testGreeterToJSValue") -public func _bjs_testGreeterToJSValue() -> Int32 { - #if arch(wasm32) - let ret = testGreeterToJSValue() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_testCalculatorToJSValue") -@_cdecl("bjs_testCalculatorToJSValue") -public func _bjs_testCalculatorToJSValue() -> Int32 { - #if arch(wasm32) - let ret = testCalculatorToJSValue() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_testSwiftClassAsJSValue") -@_cdecl("bjs_testSwiftClassAsJSValue") -public func _bjs_testSwiftClassAsJSValue(_ greeter: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = testSwiftClassAsJSValue(greeter: Greeter.bridgeJSLiftParameter(greeter)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_setDirection") -@_cdecl("bjs_setDirection") -public func _bjs_setDirection(_ direction: Int32) -> Int32 { - #if arch(wasm32) - let ret = setDirection(_: Direction.bridgeJSLiftParameter(direction)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getDirection") -@_cdecl("bjs_getDirection") -public func _bjs_getDirection() -> Int32 { - #if arch(wasm32) - let ret = getDirection() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_processDirection") -@_cdecl("bjs_processDirection") -public func _bjs_processDirection(_ input: Int32) -> Int32 { - #if arch(wasm32) - let ret = processDirection(_: Direction.bridgeJSLiftParameter(input)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_setTheme") -@_cdecl("bjs_setTheme") -public func _bjs_setTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Void { - #if arch(wasm32) - let ret = setTheme(_: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getTheme") -@_cdecl("bjs_getTheme") -public func _bjs_getTheme() -> Void { - #if arch(wasm32) - let ret = getTheme() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_setHttpStatus") -@_cdecl("bjs_setHttpStatus") -public func _bjs_setHttpStatus(_ status: Int32) -> Int32 { - #if arch(wasm32) - let ret = setHttpStatus(_: HttpStatus.bridgeJSLiftParameter(status)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getHttpStatus") -@_cdecl("bjs_getHttpStatus") -public func _bjs_getHttpStatus() -> Int32 { - #if arch(wasm32) - let ret = getHttpStatus() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_setFileSize") -@_cdecl("bjs_setFileSize") -public func _bjs_setFileSize(_ size: Int64) -> Int64 { - #if arch(wasm32) - let ret = setFileSize(_: FileSize.bridgeJSLiftParameter(size)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getFileSize") -@_cdecl("bjs_getFileSize") -public func _bjs_getFileSize() -> Int64 { - #if arch(wasm32) - let ret = getFileSize() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_setSessionId") -@_cdecl("bjs_setSessionId") -public func _bjs_setSessionId(_ session: Int64) -> Int64 { - #if arch(wasm32) - let ret = setSessionId(_: SessionId.bridgeJSLiftParameter(session)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getSessionId") -@_cdecl("bjs_getSessionId") -public func _bjs_getSessionId() -> Int64 { - #if arch(wasm32) - let ret = getSessionId() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_processTheme") -@_cdecl("bjs_processTheme") -public func _bjs_processTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Int32 { - #if arch(wasm32) - let ret = processTheme(_: Theme.bridgeJSLiftParameter(themeBytes, themeLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_setTSDirection") -@_cdecl("bjs_setTSDirection") -public func _bjs_setTSDirection(_ direction: Int32) -> Int32 { - #if arch(wasm32) - let ret = setTSDirection(_: TSDirection.bridgeJSLiftParameter(direction)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getTSDirection") -@_cdecl("bjs_getTSDirection") -public func _bjs_getTSDirection() -> Int32 { - #if arch(wasm32) - let ret = getTSDirection() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_setTSTheme") -@_cdecl("bjs_setTSTheme") -public func _bjs_setTSTheme(_ themeBytes: Int32, _ themeLength: Int32) -> Void { - #if arch(wasm32) - let ret = setTSTheme(_: TSTheme.bridgeJSLiftParameter(themeBytes, themeLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getTSTheme") -@_cdecl("bjs_getTSTheme") -public func _bjs_getTSTheme() -> Void { - #if arch(wasm32) - let ret = getTSTheme() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_createConverter") -@_cdecl("bjs_createConverter") -public func _bjs_createConverter() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = createConverter() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_useConverter") -@_cdecl("bjs_useConverter") -public func _bjs_useConverter(_ converter: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - let ret = useConverter(converter: Utils.Converter.bridgeJSLiftParameter(converter), value: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripConverterArray") -@_cdecl("bjs_roundTripConverterArray") -public func _bjs_roundTripConverterArray() -> Void { - #if arch(wasm32) - let ret = roundTripConverterArray(_: [Utils.Converter].bridgeJSStackPop()) - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_createHTTPServer") -@_cdecl("bjs_createHTTPServer") -public func _bjs_createHTTPServer() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = createHTTPServer() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_createUUID") -@_cdecl("bjs_createUUID") -public func _bjs_createUUID(_ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = createUUID(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripUUID") -@_cdecl("bjs_roundTripUUID") -public func _bjs_roundTripUUID(_ uuid: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = roundTripUUID(_: UUID.bridgeJSLiftParameter(uuid)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundtripNetworkingAPIMethod") -@_cdecl("bjs_roundtripNetworkingAPIMethod") -public func _bjs_roundtripNetworkingAPIMethod(_ method: Int32) -> Int32 { - #if arch(wasm32) - let ret = roundtripNetworkingAPIMethod(_: Networking.API.Method.bridgeJSLiftParameter(method)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundtripConfigurationLogLevel") -@_cdecl("bjs_roundtripConfigurationLogLevel") -public func _bjs_roundtripConfigurationLogLevel(_ levelBytes: Int32, _ levelLength: Int32) -> Void { - #if arch(wasm32) - let ret = roundtripConfigurationLogLevel(_: Configuration.LogLevel.bridgeJSLiftParameter(levelBytes, levelLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundtripConfigurationPort") -@_cdecl("bjs_roundtripConfigurationPort") -public func _bjs_roundtripConfigurationPort(_ port: Int32) -> Int32 { - #if arch(wasm32) - let ret = roundtripConfigurationPort(_: Configuration.Port.bridgeJSLiftParameter(port)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_processConfigurationLogLevel") -@_cdecl("bjs_processConfigurationLogLevel") -public func _bjs_processConfigurationLogLevel(_ levelBytes: Int32, _ levelLength: Int32) -> Int32 { - #if arch(wasm32) - let ret = processConfigurationLogLevel(_: Configuration.LogLevel.bridgeJSLiftParameter(levelBytes, levelLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundtripInternalSupportedMethod") -@_cdecl("bjs_roundtripInternalSupportedMethod") -public func _bjs_roundtripInternalSupportedMethod(_ method: Int32) -> Int32 { - #if arch(wasm32) - let ret = roundtripInternalSupportedMethod(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundtripAPIResult") -@_cdecl("bjs_roundtripAPIResult") -public func _bjs_roundtripAPIResult(_ result: Int32) -> Void { - #if arch(wasm32) - let ret = roundtripAPIResult(result: APIResult.bridgeJSLiftParameter(result)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeAPIResultSuccess") -@_cdecl("bjs_makeAPIResultSuccess") -public func _bjs_makeAPIResultSuccess(_ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - let ret = makeAPIResultSuccess(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeAPIResultFailure") -@_cdecl("bjs_makeAPIResultFailure") -public func _bjs_makeAPIResultFailure(_ value: Int32) -> Void { - #if arch(wasm32) - let ret = makeAPIResultFailure(_: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeAPIResultInfo") -@_cdecl("bjs_makeAPIResultInfo") -public func _bjs_makeAPIResultInfo() -> Void { - #if arch(wasm32) - let ret = makeAPIResultInfo() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeAPIResultFlag") -@_cdecl("bjs_makeAPIResultFlag") -public func _bjs_makeAPIResultFlag(_ value: Int32) -> Void { - #if arch(wasm32) - let ret = makeAPIResultFlag(_: Bool.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeAPIResultRate") -@_cdecl("bjs_makeAPIResultRate") -public func _bjs_makeAPIResultRate(_ value: Float32) -> Void { - #if arch(wasm32) - let ret = makeAPIResultRate(_: Float.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeAPIResultPrecise") -@_cdecl("bjs_makeAPIResultPrecise") -public func _bjs_makeAPIResultPrecise(_ value: Float64) -> Void { - #if arch(wasm32) - let ret = makeAPIResultPrecise(_: Double.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundtripComplexResult") -@_cdecl("bjs_roundtripComplexResult") -public func _bjs_roundtripComplexResult(_ result: Int32) -> Void { - #if arch(wasm32) - let ret = roundtripComplexResult(_: ComplexResult.bridgeJSLiftParameter(result)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeComplexResultSuccess") -@_cdecl("bjs_makeComplexResultSuccess") -public func _bjs_makeComplexResultSuccess(_ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - let ret = makeComplexResultSuccess(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeComplexResultError") -@_cdecl("bjs_makeComplexResultError") -public func _bjs_makeComplexResultError(_ messageBytes: Int32, _ messageLength: Int32, _ code: Int32) -> Void { - #if arch(wasm32) - let ret = makeComplexResultError(_: String.bridgeJSLiftParameter(messageBytes, messageLength), _: Int.bridgeJSLiftParameter(code)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeComplexResultLocation") -@_cdecl("bjs_makeComplexResultLocation") -public func _bjs_makeComplexResultLocation(_ lat: Float64, _ lng: Float64, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - #if arch(wasm32) - let ret = makeComplexResultLocation(_: Double.bridgeJSLiftParameter(lat), _: Double.bridgeJSLiftParameter(lng), _: String.bridgeJSLiftParameter(nameBytes, nameLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeComplexResultStatus") -@_cdecl("bjs_makeComplexResultStatus") -public func _bjs_makeComplexResultStatus(_ active: Int32, _ code: Int32, _ messageBytes: Int32, _ messageLength: Int32) -> Void { - #if arch(wasm32) - let ret = makeComplexResultStatus(_: Bool.bridgeJSLiftParameter(active), _: Int.bridgeJSLiftParameter(code), _: String.bridgeJSLiftParameter(messageBytes, messageLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeComplexResultCoordinates") -@_cdecl("bjs_makeComplexResultCoordinates") -public func _bjs_makeComplexResultCoordinates(_ x: Float64, _ y: Float64, _ z: Float64) -> Void { - #if arch(wasm32) - let ret = makeComplexResultCoordinates(_: Double.bridgeJSLiftParameter(x), _: Double.bridgeJSLiftParameter(y), _: Double.bridgeJSLiftParameter(z)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeComplexResultComprehensive") -@_cdecl("bjs_makeComplexResultComprehensive") -public func _bjs_makeComplexResultComprehensive(_ flag1: Int32, _ flag2: Int32, _ count1: Int32, _ count2: Int32, _ value1: Float64, _ value2: Float64, _ text1Bytes: Int32, _ text1Length: Int32, _ text2Bytes: Int32, _ text2Length: Int32, _ text3Bytes: Int32, _ text3Length: Int32) -> Void { - #if arch(wasm32) - let ret = makeComplexResultComprehensive(_: Bool.bridgeJSLiftParameter(flag1), _: Bool.bridgeJSLiftParameter(flag2), _: Int.bridgeJSLiftParameter(count1), _: Int.bridgeJSLiftParameter(count2), _: Double.bridgeJSLiftParameter(value1), _: Double.bridgeJSLiftParameter(value2), _: String.bridgeJSLiftParameter(text1Bytes, text1Length), _: String.bridgeJSLiftParameter(text2Bytes, text2Length), _: String.bridgeJSLiftParameter(text3Bytes, text3Length)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeComplexResultInfo") -@_cdecl("bjs_makeComplexResultInfo") -public func _bjs_makeComplexResultInfo() -> Void { - #if arch(wasm32) - let ret = makeComplexResultInfo() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeUtilitiesResultSuccess") -@_cdecl("bjs_makeUtilitiesResultSuccess") -public func _bjs_makeUtilitiesResultSuccess(_ messageBytes: Int32, _ messageLength: Int32) -> Void { - #if arch(wasm32) - let ret = makeUtilitiesResultSuccess(_: String.bridgeJSLiftParameter(messageBytes, messageLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeUtilitiesResultFailure") -@_cdecl("bjs_makeUtilitiesResultFailure") -public func _bjs_makeUtilitiesResultFailure(_ errorBytes: Int32, _ errorLength: Int32, _ code: Int32) -> Void { - #if arch(wasm32) - let ret = makeUtilitiesResultFailure(_: String.bridgeJSLiftParameter(errorBytes, errorLength), _: Int.bridgeJSLiftParameter(code)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeUtilitiesResultStatus") -@_cdecl("bjs_makeUtilitiesResultStatus") -public func _bjs_makeUtilitiesResultStatus(_ active: Int32, _ code: Int32, _ messageBytes: Int32, _ messageLength: Int32) -> Void { - #if arch(wasm32) - let ret = makeUtilitiesResultStatus(_: Bool.bridgeJSLiftParameter(active), _: Int.bridgeJSLiftParameter(code), _: String.bridgeJSLiftParameter(messageBytes, messageLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeAPINetworkingResultSuccess") -@_cdecl("bjs_makeAPINetworkingResultSuccess") -public func _bjs_makeAPINetworkingResultSuccess(_ messageBytes: Int32, _ messageLength: Int32) -> Void { - #if arch(wasm32) - let ret = makeAPINetworkingResultSuccess(_: String.bridgeJSLiftParameter(messageBytes, messageLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeAPINetworkingResultFailure") -@_cdecl("bjs_makeAPINetworkingResultFailure") -public func _bjs_makeAPINetworkingResultFailure(_ errorBytes: Int32, _ errorLength: Int32, _ code: Int32) -> Void { - #if arch(wasm32) - let ret = makeAPINetworkingResultFailure(_: String.bridgeJSLiftParameter(errorBytes, errorLength), _: Int.bridgeJSLiftParameter(code)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundtripUtilitiesResult") -@_cdecl("bjs_roundtripUtilitiesResult") -public func _bjs_roundtripUtilitiesResult(_ result: Int32) -> Void { - #if arch(wasm32) - let ret = roundtripUtilitiesResult(_: Utilities.Result.bridgeJSLiftParameter(result)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundtripAPINetworkingResult") -@_cdecl("bjs_roundtripAPINetworkingResult") -public func _bjs_roundtripAPINetworkingResult(_ result: Int32) -> Void { - #if arch(wasm32) - let ret = roundtripAPINetworkingResult(_: API.NetworkingResult.bridgeJSLiftParameter(result)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripAllTypesResult") -@_cdecl("bjs_roundTripAllTypesResult") -public func _bjs_roundTripAllTypesResult(_ result: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripAllTypesResult(_: AllTypesResult.bridgeJSLiftParameter(result)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripTypedPayloadResult") -@_cdecl("bjs_roundTripTypedPayloadResult") -public func _bjs_roundTripTypedPayloadResult(_ result: Int32) -> Void { - #if arch(wasm32) - let ret = roundTripTypedPayloadResult(_: TypedPayloadResult.bridgeJSLiftParameter(result)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_createPropertyHolder") -@_cdecl("bjs_createPropertyHolder") -public func _bjs_createPropertyHolder(_ intValue: Int32, _ floatValue: Float32, _ doubleValue: Float64, _ boolValue: Int32, _ stringValueBytes: Int32, _ stringValueLength: Int32, _ jsObject: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = createPropertyHolder(intValue: Int.bridgeJSLiftParameter(intValue), floatValue: Float.bridgeJSLiftParameter(floatValue), doubleValue: Double.bridgeJSLiftParameter(doubleValue), boolValue: Bool.bridgeJSLiftParameter(boolValue), stringValue: String.bridgeJSLiftParameter(stringValueBytes, stringValueLength), jsObject: JSObject.bridgeJSLiftParameter(jsObject)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_testPropertyHolder") -@_cdecl("bjs_testPropertyHolder") -public func _bjs_testPropertyHolder(_ holder: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = testPropertyHolder(holder: PropertyHolder.bridgeJSLiftParameter(holder)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_resetObserverCounts") -@_cdecl("bjs_resetObserverCounts") -public func _bjs_resetObserverCounts() -> Void { - #if arch(wasm32) - resetObserverCounts() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getObserverStats") -@_cdecl("bjs_getObserverStats") -public func _bjs_getObserverStats() -> Void { - #if arch(wasm32) - let ret = getObserverStats() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_formatName") -@_cdecl("bjs_formatName") -public func _bjs_formatName(_ nameBytes: Int32, _ nameLength: Int32, _ transform: Int32) -> Void { - #if arch(wasm32) - let ret = formatName(_: String.bridgeJSLiftParameter(nameBytes, nameLength), transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeFormatter") -@_cdecl("bjs_makeFormatter") -public func _bjs_makeFormatter(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { - #if arch(wasm32) - let ret = makeFormatter(prefix: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_makeAdder") -@_cdecl("bjs_makeAdder") -public func _bjs_makeAdder(_ base: Int32) -> Int32 { - #if arch(wasm32) - let ret = makeAdder(base: Int.bridgeJSLiftParameter(base)) - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getSharedSubject") -@_cdecl("bjs_getSharedSubject") -public func _bjs_getSharedSubject() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = getSharedSubject() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_resetSharedSubject") -@_cdecl("bjs_resetSharedSubject") -public func _bjs_resetSharedSubject() -> Void { - #if arch(wasm32) - resetSharedSubject() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getRetainLeakSubject") -@_cdecl("bjs_getRetainLeakSubject") -public func _bjs_getRetainLeakSubject() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = getRetainLeakSubject() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_resetRetainLeakSubject") -@_cdecl("bjs_resetRetainLeakSubject") -public func _bjs_resetRetainLeakSubject() -> Void { - #if arch(wasm32) - resetRetainLeakSubject() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getRetainLeakDeinits") -@_cdecl("bjs_getRetainLeakDeinits") -public func _bjs_getRetainLeakDeinits() -> Int32 { - #if arch(wasm32) - let ret = getRetainLeakDeinits() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_resetRetainLeakDeinits") -@_cdecl("bjs_resetRetainLeakDeinits") -public func _bjs_resetRetainLeakDeinits() -> Void { - #if arch(wasm32) - resetRetainLeakDeinits() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_setupArrayPool") -@_cdecl("bjs_setupArrayPool") -public func _bjs_setupArrayPool(_ count: Int32) -> Void { - #if arch(wasm32) - setupArrayPool(_: Int.bridgeJSLiftParameter(count)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getArrayPool") -@_cdecl("bjs_getArrayPool") -public func _bjs_getArrayPool() -> Void { - #if arch(wasm32) - let ret = getArrayPool() - ret.bridgeJSStackPush() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getArrayPoolElement") -@_cdecl("bjs_getArrayPoolElement") -public func _bjs_getArrayPoolElement(_ index: Int32) -> Void { - #if arch(wasm32) - let ret = getArrayPoolElement(_: Int.bridgeJSLiftParameter(index)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_getArrayPoolDeinits") -@_cdecl("bjs_getArrayPoolDeinits") -public func _bjs_getArrayPoolDeinits() -> Int32 { - #if arch(wasm32) - let ret = getArrayPoolDeinits() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_resetArrayPoolDeinits") -@_cdecl("bjs_resetArrayPoolDeinits") -public func _bjs_resetArrayPoolDeinits() -> Void { - #if arch(wasm32) - resetArrayPoolDeinits() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_clearArrayPool") -@_cdecl("bjs_clearArrayPool") -public func _bjs_clearArrayPool() -> Void { - #if arch(wasm32) - clearArrayPool() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripPointerFields") -@_cdecl("bjs_roundTripPointerFields") -public func _bjs_roundTripPointerFields() -> Void { - #if arch(wasm32) - let ret = roundTripPointerFields(_: PointerFields.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_testStructDefault") -@_cdecl("bjs_testStructDefault") -public func _bjs_testStructDefault() -> Void { - #if arch(wasm32) - let ret = testStructDefault(point: DataPoint.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_cartToJSObject") -@_cdecl("bjs_cartToJSObject") -public func _bjs_cartToJSObject() -> Int32 { - #if arch(wasm32) - let ret = cartToJSObject(_: CopyableCart.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_nestedCartToJSObject") -@_cdecl("bjs_nestedCartToJSObject") -public func _bjs_nestedCartToJSObject() -> Int32 { - #if arch(wasm32) - let ret = nestedCartToJSObject(_: CopyableNestedCart.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripDataPoint") -@_cdecl("bjs_roundTripDataPoint") -public func _bjs_roundTripDataPoint() -> Void { - #if arch(wasm32) - let ret = roundTripDataPoint(_: DataPoint.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripPublicPoint") -@_cdecl("bjs_roundTripPublicPoint") -public func _bjs_roundTripPublicPoint() -> Void { - #if arch(wasm32) - let ret = roundTripPublicPoint(_: PublicPoint.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripContact") -@_cdecl("bjs_roundTripContact") -public func _bjs_roundTripContact() -> Void { - #if arch(wasm32) - let ret = roundTripContact(_: Contact.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripConfig") -@_cdecl("bjs_roundTripConfig") -public func _bjs_roundTripConfig() -> Void { - #if arch(wasm32) - let ret = roundTripConfig(_: Config.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripSessionData") -@_cdecl("bjs_roundTripSessionData") -public func _bjs_roundTripSessionData() -> Void { - #if arch(wasm32) - let ret = roundTripSessionData(_: SessionData.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripValidationReport") -@_cdecl("bjs_roundTripValidationReport") -public func _bjs_roundTripValidationReport() -> Void { - #if arch(wasm32) - let ret = roundTripValidationReport(_: ValidationReport.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripAdvancedConfig") -@_cdecl("bjs_roundTripAdvancedConfig") -public func _bjs_roundTripAdvancedConfig() -> Void { - #if arch(wasm32) - let ret = roundTripAdvancedConfig(_: AdvancedConfig.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripMeasurementConfig") -@_cdecl("bjs_roundTripMeasurementConfig") -public func _bjs_roundTripMeasurementConfig() -> Void { - #if arch(wasm32) - let ret = roundTripMeasurementConfig(_: MeasurementConfig.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_updateValidationReport") -@_cdecl("bjs_updateValidationReport") -public func _bjs_updateValidationReport(_ newResultIsSome: Int32, _ newResultCaseId: Int32) -> Void { - #if arch(wasm32) - let _tmp_report = ValidationReport.bridgeJSLiftParameter() - let _tmp_newResult = Optional.bridgeJSLiftParameter(newResultIsSome, newResultCaseId) - let ret = updateValidationReport(_: _tmp_newResult, _: _tmp_report) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_testContainerWithStruct") -@_cdecl("bjs_testContainerWithStruct") -public func _bjs_testContainerWithStruct() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = testContainerWithStruct(_: DataPoint.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripJSObjectContainer") -@_cdecl("bjs_roundTripJSObjectContainer") -public func _bjs_roundTripJSObjectContainer() -> Void { - #if arch(wasm32) - let ret = roundTripJSObjectContainer(_: JSObjectContainer.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripFooContainer") -@_cdecl("bjs_roundTripFooContainer") -public func _bjs_roundTripFooContainer() -> Void { - #if arch(wasm32) - let ret = roundTripFooContainer(_: FooContainer.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_roundTripArrayMembers") -@_cdecl("bjs_roundTripArrayMembers") -public func _bjs_roundTripArrayMembers() -> Void { - #if arch(wasm32) - let ret = roundTripArrayMembers(_: ArrayMembers.bridgeJSLiftParameter()) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_arrayMembersSum") -@_cdecl("bjs_arrayMembersSum") -public func _bjs_arrayMembersSum() -> Int32 { - #if arch(wasm32) - let _tmp_values = [Int].bridgeJSStackPop() - let _tmp_value = ArrayMembers.bridgeJSLiftParameter() - let ret = arrayMembersSum(_: _tmp_value, _: _tmp_values) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_arrayMembersFirst") -@_cdecl("bjs_arrayMembersFirst") -public func _bjs_arrayMembersFirst() -> Void { - #if arch(wasm32) - let _tmp_values = [String].bridgeJSStackPop() - let _tmp_value = ArrayMembers.bridgeJSLiftParameter() - let ret = arrayMembersFirst(_: _tmp_value, _: _tmp_values) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ClosureSupportExports_static_makeIntToInt") -@_cdecl("bjs_ClosureSupportExports_static_makeIntToInt") -public func _bjs_ClosureSupportExports_static_makeIntToInt(_ base: Int32) -> Int32 { - #if arch(wasm32) - let ret = ClosureSupportExports.makeIntToInt(_: Int.bridgeJSLiftParameter(base)) - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ClosureSupportExports_static_makeDoubleToDouble") -@_cdecl("bjs_ClosureSupportExports_static_makeDoubleToDouble") -public func _bjs_ClosureSupportExports_static_makeDoubleToDouble(_ base: Float64) -> Int32 { - #if arch(wasm32) - let ret = ClosureSupportExports.makeDoubleToDouble(_: Double.bridgeJSLiftParameter(base)) - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ClosureSupportExports_static_makeStringToString") -@_cdecl("bjs_ClosureSupportExports_static_makeStringToString") -public func _bjs_ClosureSupportExports_static_makeStringToString(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { - #if arch(wasm32) - let ret = ClosureSupportExports.makeStringToString(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ClosureSupportExports_static_makeJSIntToInt") -@_cdecl("bjs_ClosureSupportExports_static_makeJSIntToInt") -public func _bjs_ClosureSupportExports_static_makeJSIntToInt(_ base: Int32) -> Int32 { - #if arch(wasm32) - let ret = ClosureSupportExports.makeJSIntToInt(_: Int.bridgeJSLiftParameter(base)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ClosureSupportExports_static_makeJSDoubleToDouble") -@_cdecl("bjs_ClosureSupportExports_static_makeJSDoubleToDouble") -public func _bjs_ClosureSupportExports_static_makeJSDoubleToDouble(_ base: Float64) -> Int32 { - #if arch(wasm32) - let ret = ClosureSupportExports.makeJSDoubleToDouble(_: Double.bridgeJSLiftParameter(base)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ClosureSupportExports_static_makeJSStringToString") -@_cdecl("bjs_ClosureSupportExports_static_makeJSStringToString") -public func _bjs_ClosureSupportExports_static_makeJSStringToString(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { - #if arch(wasm32) - let ret = ClosureSupportExports.makeJSStringToString(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ClosureSupportExports_deinit") -@_cdecl("bjs_ClosureSupportExports_deinit") -public func _bjs_ClosureSupportExports_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension ClosureSupportExports: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_ClosureSupportExports_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_ClosureSupportExports_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportExports_wrap") -fileprivate func _bjs_ClosureSupportExports_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_ClosureSupportExports_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_ClosureSupportExports_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_ClosureSupportExports_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_init") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_init") -public func _bjs_DefaultArgumentConstructorDefaults_init(_ nameBytes: Int32, _ nameLength: Int32, _ count: Int32, _ enabled: Int32, _ status: Int32, _ tagIsSome: Int32, _ tagBytes: Int32, _ tagLength: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = DefaultArgumentConstructorDefaults(name: String.bridgeJSLiftParameter(nameBytes, nameLength), count: Int.bridgeJSLiftParameter(count), enabled: Bool.bridgeJSLiftParameter(enabled), status: Status.bridgeJSLiftParameter(status), tag: Optional.bridgeJSLiftParameter(tagIsSome, tagBytes, tagLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_describe") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_describe") -public func _bjs_DefaultArgumentConstructorDefaults_describe(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).describe() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_name_get") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_name_get") -public func _bjs_DefaultArgumentConstructorDefaults_name_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).name - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_name_set") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_name_set") -public func _bjs_DefaultArgumentConstructorDefaults_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_count_get") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_count_get") -public func _bjs_DefaultArgumentConstructorDefaults_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).count - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_count_set") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_count_set") -public func _bjs_DefaultArgumentConstructorDefaults_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_enabled_get") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_enabled_get") -public func _bjs_DefaultArgumentConstructorDefaults_enabled_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).enabled - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_enabled_set") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_enabled_set") -public func _bjs_DefaultArgumentConstructorDefaults_enabled_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).enabled = Bool.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_status_get") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_status_get") -public func _bjs_DefaultArgumentConstructorDefaults_status_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).status - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_status_set") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_status_set") -public func _bjs_DefaultArgumentConstructorDefaults_status_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).status = Status.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_tag_get") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_tag_get") -public func _bjs_DefaultArgumentConstructorDefaults_tag_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).tag - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_tag_set") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_tag_set") -public func _bjs_DefaultArgumentConstructorDefaults_tag_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - DefaultArgumentConstructorDefaults.bridgeJSLiftParameter(_self).tag = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DefaultArgumentConstructorDefaults_deinit") -@_cdecl("bjs_DefaultArgumentConstructorDefaults_deinit") -public func _bjs_DefaultArgumentConstructorDefaults_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension DefaultArgumentConstructorDefaults: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_DefaultArgumentConstructorDefaults_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_DefaultArgumentConstructorDefaults_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DefaultArgumentConstructorDefaults_wrap") -fileprivate func _bjs_DefaultArgumentConstructorDefaults_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_DefaultArgumentConstructorDefaults_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_DefaultArgumentConstructorDefaults_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_DefaultArgumentConstructorDefaults_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_Greeter_init") -@_cdecl("bjs_Greeter_init") -public func _bjs_Greeter_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = Greeter(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_greet") -@_cdecl("bjs_Greeter_greet") -public func _bjs_Greeter_greet(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = Greeter.bridgeJSLiftParameter(_self).greet() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_changeName") -@_cdecl("bjs_Greeter_changeName") -public func _bjs_Greeter_changeName(_ _self: UnsafeMutableRawPointer, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - #if arch(wasm32) - Greeter.bridgeJSLiftParameter(_self).changeName(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_greetWith") -@_cdecl("bjs_Greeter_greetWith") -public func _bjs_Greeter_greetWith(_ _self: UnsafeMutableRawPointer, _ greeter: UnsafeMutableRawPointer, _ customGreeting: Int32) -> Void { - #if arch(wasm32) - let ret = Greeter.bridgeJSLiftParameter(_self).greetWith(greeter: Greeter.bridgeJSLiftParameter(greeter), customGreeting: _BJS_Closure_20BridgeJSRuntimeTests7GreeterC_SS.bridgeJSLift(customGreeting)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_makeFormatter") -@_cdecl("bjs_Greeter_makeFormatter") -public func _bjs_Greeter_makeFormatter(_ _self: UnsafeMutableRawPointer, _ suffixBytes: Int32, _ suffixLength: Int32) -> Int32 { - #if arch(wasm32) - let ret = Greeter.bridgeJSLiftParameter(_self).makeFormatter(suffix: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_static_makeCreator") -@_cdecl("bjs_Greeter_static_makeCreator") -public func _bjs_Greeter_static_makeCreator(_ defaultNameBytes: Int32, _ defaultNameLength: Int32) -> Int32 { - #if arch(wasm32) - let ret = Greeter.makeCreator(defaultName: String.bridgeJSLiftParameter(defaultNameBytes, defaultNameLength)) - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_makeCustomGreeter") -@_cdecl("bjs_Greeter_makeCustomGreeter") -public func _bjs_Greeter_makeCustomGreeter(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = Greeter.bridgeJSLiftParameter(_self).makeCustomGreeter() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_greetEnthusiastically") -@_cdecl("bjs_Greeter_greetEnthusiastically") -public func _bjs_Greeter_greetEnthusiastically(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = Greeter.bridgeJSLiftParameter(_self).greetEnthusiastically() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_static_greetAnonymously") -@_cdecl("bjs_Greeter_static_greetAnonymously") -public func _bjs_Greeter_static_greetAnonymously() -> Void { - #if arch(wasm32) - let ret = Greeter.greetAnonymously() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_name_get") -@_cdecl("bjs_Greeter_name_get") -public func _bjs_Greeter_name_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = Greeter.bridgeJSLiftParameter(_self).name - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_name_set") -@_cdecl("bjs_Greeter_name_set") -public func _bjs_Greeter_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - Greeter.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_prefix_get") -@_cdecl("bjs_Greeter_prefix_get") -public func _bjs_Greeter_prefix_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = Greeter.bridgeJSLiftParameter(_self).prefix - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_nameCount_get") -@_cdecl("bjs_Greeter_nameCount_get") -public func _bjs_Greeter_nameCount_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = Greeter.bridgeJSLiftParameter(_self).nameCount - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_static_defaultGreeting_get") -@_cdecl("bjs_Greeter_static_defaultGreeting_get") -public func _bjs_Greeter_static_defaultGreeting_get() -> Void { - #if arch(wasm32) - let ret = Greeter.defaultGreeting - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Greeter_deinit") -@_cdecl("bjs_Greeter_deinit") -public func _bjs_Greeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Greeter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - public var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - public consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_Greeter_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Greeter_wrap") -fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Greeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_Greeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_Greeter_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_Calculator_square") -@_cdecl("bjs_Calculator_square") -public func _bjs_Calculator_square(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Int32 { - #if arch(wasm32) - let ret = Calculator.bridgeJSLiftParameter(_self).square(value: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Calculator_add") -@_cdecl("bjs_Calculator_add") -public func _bjs_Calculator_add(_ _self: UnsafeMutableRawPointer, _ a: Int32, _ b: Int32) -> Int32 { - #if arch(wasm32) - let ret = Calculator.bridgeJSLiftParameter(_self).add(a: Int.bridgeJSLiftParameter(a), b: Int.bridgeJSLiftParameter(b)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Calculator_deinit") -@_cdecl("bjs_Calculator_deinit") -public func _bjs_Calculator_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Calculator: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Calculator_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_Calculator_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Calculator_wrap") -fileprivate func _bjs_Calculator_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Calculator_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_Calculator_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_Calculator_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_InternalGreeter_deinit") -@_cdecl("bjs_InternalGreeter_deinit") -public func _bjs_InternalGreeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension InternalGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - internal var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_InternalGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - internal consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_InternalGreeter_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_InternalGreeter_wrap") -fileprivate func _bjs_InternalGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_InternalGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_InternalGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_InternalGreeter_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_PublicGreeter_deinit") -@_cdecl("bjs_PublicGreeter_deinit") -public func _bjs_PublicGreeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension PublicGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - public var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_PublicGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - public consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_PublicGreeter_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PublicGreeter_wrap") -fileprivate func _bjs_PublicGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_PublicGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_PublicGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_PublicGreeter_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_PackageGreeter_deinit") -@_cdecl("bjs_PackageGreeter_deinit") -public func _bjs_PackageGreeter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension PackageGreeter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - package var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_PackageGreeter_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - package consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_PackageGreeter_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PackageGreeter_wrap") -fileprivate func _bjs_PackageGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_PackageGreeter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_PackageGreeter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_PackageGreeter_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_Utils_Converter_init") -@_cdecl("bjs_Utils_Converter_init") -public func _bjs_Utils_Converter_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = Utils.Converter() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Utils_Converter_toString") -@_cdecl("bjs_Utils_Converter_toString") -public func _bjs_Utils_Converter_toString(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - let ret = Utils.Converter.bridgeJSLiftParameter(_self).toString(value: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Utils_Converter_precision_get") -@_cdecl("bjs_Utils_Converter_precision_get") -public func _bjs_Utils_Converter_precision_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = Utils.Converter.bridgeJSLiftParameter(_self).precision - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Utils_Converter_precision_set") -@_cdecl("bjs_Utils_Converter_precision_set") -public func _bjs_Utils_Converter_precision_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - Utils.Converter.bridgeJSLiftParameter(_self).precision = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Utils_Converter_deinit") -@_cdecl("bjs_Utils_Converter_deinit") -public func _bjs_Utils_Converter_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Utils.Converter: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Utils_Converter_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_Utils_Converter_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Utils_Converter_wrap") -fileprivate func _bjs_Utils_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Utils_Converter_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_Utils_Converter_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_Utils_Converter_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_Networking_API_HTTPServer_init") -@_cdecl("bjs_Networking_API_HTTPServer_init") -public func _bjs_Networking_API_HTTPServer_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = Networking.API.HTTPServer() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Networking_API_HTTPServer_call") -@_cdecl("bjs_Networking_API_HTTPServer_call") -public func _bjs_Networking_API_HTTPServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { - #if arch(wasm32) - Networking.API.HTTPServer.bridgeJSLiftParameter(_self).call(_: Networking.API.Method.bridgeJSLiftParameter(method)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Networking_API_HTTPServer_deinit") -@_cdecl("bjs_Networking_API_HTTPServer_deinit") -public func _bjs_Networking_API_HTTPServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Networking.API.HTTPServer: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Networking_API_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_Networking_API_HTTPServer_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Networking_API_HTTPServer_wrap") -fileprivate func _bjs_Networking_API_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Networking_API_HTTPServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_Networking_API_HTTPServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_Networking_API_HTTPServer_wrap_extern(pointer) -} - -@_expose(wasm, "bjs___Swift_Foundation_UUID_init") -@_cdecl("bjs___Swift_Foundation_UUID_init") -public func _bjs___Swift_Foundation_UUID_init(_ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = UUID(value: String.bridgeJSLiftParameter(valueBytes, valueLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs___Swift_Foundation_UUID_uuidString") -@_cdecl("bjs___Swift_Foundation_UUID_uuidString") -public func _bjs___Swift_Foundation_UUID_uuidString(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = UUID.bridgeJSLiftParameter(_self).uuidString() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs___Swift_Foundation_UUID_static_fromValue") -@_cdecl("bjs___Swift_Foundation_UUID_static_fromValue") -public func _bjs___Swift_Foundation_UUID_static_fromValue(_ valueBytes: Int32, _ valueLength: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = UUID.fromValue(_: String.bridgeJSLiftParameter(valueBytes, valueLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs___Swift_Foundation_UUID_static_placeholder_get") -@_cdecl("bjs___Swift_Foundation_UUID_static_placeholder_get") -public func _bjs___Swift_Foundation_UUID_static_placeholder_get() -> Void { - #if arch(wasm32) - let ret = UUID.placeholder - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs___Swift_Foundation_UUID_deinit") -@_cdecl("bjs___Swift_Foundation_UUID_deinit") -public func _bjs___Swift_Foundation_UUID_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension UUID: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs___Swift_Foundation_UUID_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs___Swift_Foundation_UUID_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs___Swift_Foundation_UUID_wrap") -fileprivate func _bjs___Swift_Foundation_UUID_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs___Swift_Foundation_UUID_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs___Swift_Foundation_UUID_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs___Swift_Foundation_UUID_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_Networking_APIV2_Internal_TestServer_init") -@_cdecl("bjs_Networking_APIV2_Internal_TestServer_init") -public func _bjs_Networking_APIV2_Internal_TestServer_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = Internal.TestServer() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Networking_APIV2_Internal_TestServer_call") -@_cdecl("bjs_Networking_APIV2_Internal_TestServer_call") -public func _bjs_Networking_APIV2_Internal_TestServer_call(_ _self: UnsafeMutableRawPointer, _ method: Int32) -> Void { - #if arch(wasm32) - Internal.TestServer.bridgeJSLiftParameter(_self).call(_: Internal.SupportedMethod.bridgeJSLiftParameter(method)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Networking_APIV2_Internal_TestServer_deinit") -@_cdecl("bjs_Networking_APIV2_Internal_TestServer_deinit") -public func _bjs_Networking_APIV2_Internal_TestServer_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Internal.TestServer: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Networking_APIV2_Internal_TestServer_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_Networking_APIV2_Internal_TestServer_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Networking_APIV2_Internal_TestServer_wrap") -fileprivate func _bjs_Networking_APIV2_Internal_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Networking_APIV2_Internal_TestServer_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_Networking_APIV2_Internal_TestServer_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_Networking_APIV2_Internal_TestServer_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_SimplePropertyHolder_init") -@_cdecl("bjs_SimplePropertyHolder_init") -public func _bjs_SimplePropertyHolder_init(_ value: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = SimplePropertyHolder(value: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SimplePropertyHolder_value_get") -@_cdecl("bjs_SimplePropertyHolder_value_get") -public func _bjs_SimplePropertyHolder_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = SimplePropertyHolder.bridgeJSLiftParameter(_self).value - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SimplePropertyHolder_value_set") -@_cdecl("bjs_SimplePropertyHolder_value_set") -public func _bjs_SimplePropertyHolder_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - SimplePropertyHolder.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SimplePropertyHolder_deinit") -@_cdecl("bjs_SimplePropertyHolder_deinit") -public func _bjs_SimplePropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension SimplePropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_SimplePropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_SimplePropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SimplePropertyHolder_wrap") -fileprivate func _bjs_SimplePropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_SimplePropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_SimplePropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_SimplePropertyHolder_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_PropertyHolder_init") -@_cdecl("bjs_PropertyHolder_init") -public func _bjs_PropertyHolder_init(_ intValue: Int32, _ floatValue: Float32, _ doubleValue: Float64, _ boolValue: Int32, _ stringValueBytes: Int32, _ stringValueLength: Int32, _ jsObject: Int32, _ sibling: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = PropertyHolder(intValue: Int.bridgeJSLiftParameter(intValue), floatValue: Float.bridgeJSLiftParameter(floatValue), doubleValue: Double.bridgeJSLiftParameter(doubleValue), boolValue: Bool.bridgeJSLiftParameter(boolValue), stringValue: String.bridgeJSLiftParameter(stringValueBytes, stringValueLength), jsObject: JSObject.bridgeJSLiftParameter(jsObject), sibling: SimplePropertyHolder.bridgeJSLiftParameter(sibling)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_getAllValues") -@_cdecl("bjs_PropertyHolder_getAllValues") -public func _bjs_PropertyHolder_getAllValues(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).getAllValues() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_intValue_get") -@_cdecl("bjs_PropertyHolder_intValue_get") -public func _bjs_PropertyHolder_intValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).intValue - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_intValue_set") -@_cdecl("bjs_PropertyHolder_intValue_set") -public func _bjs_PropertyHolder_intValue_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).intValue = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_floatValue_get") -@_cdecl("bjs_PropertyHolder_floatValue_get") -public func _bjs_PropertyHolder_floatValue_get(_ _self: UnsafeMutableRawPointer) -> Float32 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).floatValue - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_floatValue_set") -@_cdecl("bjs_PropertyHolder_floatValue_set") -public func _bjs_PropertyHolder_floatValue_set(_ _self: UnsafeMutableRawPointer, _ value: Float32) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).floatValue = Float.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_doubleValue_get") -@_cdecl("bjs_PropertyHolder_doubleValue_get") -public func _bjs_PropertyHolder_doubleValue_get(_ _self: UnsafeMutableRawPointer) -> Float64 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).doubleValue - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_doubleValue_set") -@_cdecl("bjs_PropertyHolder_doubleValue_set") -public func _bjs_PropertyHolder_doubleValue_set(_ _self: UnsafeMutableRawPointer, _ value: Float64) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).doubleValue = Double.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_boolValue_get") -@_cdecl("bjs_PropertyHolder_boolValue_get") -public func _bjs_PropertyHolder_boolValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).boolValue - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_boolValue_set") -@_cdecl("bjs_PropertyHolder_boolValue_set") -public func _bjs_PropertyHolder_boolValue_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).boolValue = Bool.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_stringValue_get") -@_cdecl("bjs_PropertyHolder_stringValue_get") -public func _bjs_PropertyHolder_stringValue_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).stringValue - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_stringValue_set") -@_cdecl("bjs_PropertyHolder_stringValue_set") -public func _bjs_PropertyHolder_stringValue_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).stringValue = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_readonlyInt_get") -@_cdecl("bjs_PropertyHolder_readonlyInt_get") -public func _bjs_PropertyHolder_readonlyInt_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyInt - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_readonlyFloat_get") -@_cdecl("bjs_PropertyHolder_readonlyFloat_get") -public func _bjs_PropertyHolder_readonlyFloat_get(_ _self: UnsafeMutableRawPointer) -> Float32 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyFloat - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_readonlyDouble_get") -@_cdecl("bjs_PropertyHolder_readonlyDouble_get") -public func _bjs_PropertyHolder_readonlyDouble_get(_ _self: UnsafeMutableRawPointer) -> Float64 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyDouble - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_readonlyBool_get") -@_cdecl("bjs_PropertyHolder_readonlyBool_get") -public func _bjs_PropertyHolder_readonlyBool_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyBool - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_readonlyString_get") -@_cdecl("bjs_PropertyHolder_readonlyString_get") -public func _bjs_PropertyHolder_readonlyString_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).readonlyString - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_jsObject_get") -@_cdecl("bjs_PropertyHolder_jsObject_get") -public func _bjs_PropertyHolder_jsObject_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).jsObject - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_jsObject_set") -@_cdecl("bjs_PropertyHolder_jsObject_set") -public func _bjs_PropertyHolder_jsObject_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).jsObject = JSObject.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_sibling_get") -@_cdecl("bjs_PropertyHolder_sibling_get") -public func _bjs_PropertyHolder_sibling_get(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).sibling - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_sibling_set") -@_cdecl("bjs_PropertyHolder_sibling_set") -public func _bjs_PropertyHolder_sibling_set(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).sibling = SimplePropertyHolder.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_lazyValue_get") -@_cdecl("bjs_PropertyHolder_lazyValue_get") -public func _bjs_PropertyHolder_lazyValue_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).lazyValue - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_lazyValue_set") -@_cdecl("bjs_PropertyHolder_lazyValue_set") -public func _bjs_PropertyHolder_lazyValue_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).lazyValue = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_computedReadonly_get") -@_cdecl("bjs_PropertyHolder_computedReadonly_get") -public func _bjs_PropertyHolder_computedReadonly_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).computedReadonly - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_computedReadWrite_get") -@_cdecl("bjs_PropertyHolder_computedReadWrite_get") -public func _bjs_PropertyHolder_computedReadWrite_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).computedReadWrite - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_computedReadWrite_set") -@_cdecl("bjs_PropertyHolder_computedReadWrite_set") -public func _bjs_PropertyHolder_computedReadWrite_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).computedReadWrite = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_observedProperty_get") -@_cdecl("bjs_PropertyHolder_observedProperty_get") -public func _bjs_PropertyHolder_observedProperty_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = PropertyHolder.bridgeJSLiftParameter(_self).observedProperty - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_observedProperty_set") -@_cdecl("bjs_PropertyHolder_observedProperty_set") -public func _bjs_PropertyHolder_observedProperty_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - PropertyHolder.bridgeJSLiftParameter(_self).observedProperty = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_PropertyHolder_deinit") -@_cdecl("bjs_PropertyHolder_deinit") -public func _bjs_PropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension PropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_PropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_PropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_PropertyHolder_wrap") -fileprivate func _bjs_PropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_PropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_PropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_PropertyHolder_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_MathUtils_static_add") -@_cdecl("bjs_MathUtils_static_add") -public func _bjs_MathUtils_static_add(_ a: Int32, _ b: Int32) -> Int32 { - #if arch(wasm32) - let ret = MathUtils.add(a: Int.bridgeJSLiftParameter(a), b: Int.bridgeJSLiftParameter(b)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_MathUtils_static_substract") -@_cdecl("bjs_MathUtils_static_substract") -public func _bjs_MathUtils_static_substract(_ a: Int32, _ b: Int32) -> Int32 { - #if arch(wasm32) - let ret = MathUtils.substract(a: Int.bridgeJSLiftParameter(a), b: Int.bridgeJSLiftParameter(b)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_MathUtils_deinit") -@_cdecl("bjs_MathUtils_deinit") -public func _bjs_MathUtils_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension MathUtils: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_MathUtils_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_MathUtils_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MathUtils_wrap") -fileprivate func _bjs_MathUtils_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_MathUtils_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_MathUtils_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_MathUtils_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_StaticPropertyHolder_init") -@_cdecl("bjs_StaticPropertyHolder_init") -public func _bjs_StaticPropertyHolder_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = StaticPropertyHolder() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticConstant_get") -@_cdecl("bjs_StaticPropertyHolder_static_staticConstant_get") -public func _bjs_StaticPropertyHolder_static_staticConstant_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyHolder.staticConstant - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticVariable_get") -@_cdecl("bjs_StaticPropertyHolder_static_staticVariable_get") -public func _bjs_StaticPropertyHolder_static_staticVariable_get() -> Int32 { - #if arch(wasm32) - let ret = StaticPropertyHolder.staticVariable - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticVariable_set") -@_cdecl("bjs_StaticPropertyHolder_static_staticVariable_set") -public func _bjs_StaticPropertyHolder_static_staticVariable_set(_ value: Int32) -> Void { - #if arch(wasm32) - StaticPropertyHolder.staticVariable = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticString_get") -@_cdecl("bjs_StaticPropertyHolder_static_staticString_get") -public func _bjs_StaticPropertyHolder_static_staticString_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyHolder.staticString - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticString_set") -@_cdecl("bjs_StaticPropertyHolder_static_staticString_set") -public func _bjs_StaticPropertyHolder_static_staticString_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - StaticPropertyHolder.staticString = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticBool_get") -@_cdecl("bjs_StaticPropertyHolder_static_staticBool_get") -public func _bjs_StaticPropertyHolder_static_staticBool_get() -> Int32 { - #if arch(wasm32) - let ret = StaticPropertyHolder.staticBool - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticBool_set") -@_cdecl("bjs_StaticPropertyHolder_static_staticBool_set") -public func _bjs_StaticPropertyHolder_static_staticBool_set(_ value: Int32) -> Void { - #if arch(wasm32) - StaticPropertyHolder.staticBool = Bool.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticFloat_get") -@_cdecl("bjs_StaticPropertyHolder_static_staticFloat_get") -public func _bjs_StaticPropertyHolder_static_staticFloat_get() -> Float32 { - #if arch(wasm32) - let ret = StaticPropertyHolder.staticFloat - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticFloat_set") -@_cdecl("bjs_StaticPropertyHolder_static_staticFloat_set") -public func _bjs_StaticPropertyHolder_static_staticFloat_set(_ value: Float32) -> Void { - #if arch(wasm32) - StaticPropertyHolder.staticFloat = Float.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticDouble_get") -@_cdecl("bjs_StaticPropertyHolder_static_staticDouble_get") -public func _bjs_StaticPropertyHolder_static_staticDouble_get() -> Float64 { - #if arch(wasm32) - let ret = StaticPropertyHolder.staticDouble - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_staticDouble_set") -@_cdecl("bjs_StaticPropertyHolder_static_staticDouble_set") -public func _bjs_StaticPropertyHolder_static_staticDouble_set(_ value: Float64) -> Void { - #if arch(wasm32) - StaticPropertyHolder.staticDouble = Double.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_computedProperty_get") -@_cdecl("bjs_StaticPropertyHolder_static_computedProperty_get") -public func _bjs_StaticPropertyHolder_static_computedProperty_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyHolder.computedProperty - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_computedProperty_set") -@_cdecl("bjs_StaticPropertyHolder_static_computedProperty_set") -public func _bjs_StaticPropertyHolder_static_computedProperty_set(_ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - StaticPropertyHolder.computedProperty = String.bridgeJSLiftParameter(valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_readOnlyComputed_get") -@_cdecl("bjs_StaticPropertyHolder_static_readOnlyComputed_get") -public func _bjs_StaticPropertyHolder_static_readOnlyComputed_get() -> Int32 { - #if arch(wasm32) - let ret = StaticPropertyHolder.readOnlyComputed - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_optionalString_get") -@_cdecl("bjs_StaticPropertyHolder_static_optionalString_get") -public func _bjs_StaticPropertyHolder_static_optionalString_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyHolder.optionalString - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_optionalString_set") -@_cdecl("bjs_StaticPropertyHolder_static_optionalString_set") -public func _bjs_StaticPropertyHolder_static_optionalString_set(_ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - StaticPropertyHolder.optionalString = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_optionalInt_get") -@_cdecl("bjs_StaticPropertyHolder_static_optionalInt_get") -public func _bjs_StaticPropertyHolder_static_optionalInt_get() -> Void { - #if arch(wasm32) - let ret = StaticPropertyHolder.optionalInt - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_optionalInt_set") -@_cdecl("bjs_StaticPropertyHolder_static_optionalInt_set") -public func _bjs_StaticPropertyHolder_static_optionalInt_set(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - StaticPropertyHolder.optionalInt = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_jsObjectProperty_get") -@_cdecl("bjs_StaticPropertyHolder_static_jsObjectProperty_get") -public func _bjs_StaticPropertyHolder_static_jsObjectProperty_get() -> Int32 { - #if arch(wasm32) - let ret = StaticPropertyHolder.jsObjectProperty - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_static_jsObjectProperty_set") -@_cdecl("bjs_StaticPropertyHolder_static_jsObjectProperty_set") -public func _bjs_StaticPropertyHolder_static_jsObjectProperty_set(_ value: Int32) -> Void { - #if arch(wasm32) - StaticPropertyHolder.jsObjectProperty = JSObject.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_StaticPropertyHolder_deinit") -@_cdecl("bjs_StaticPropertyHolder_deinit") -public func _bjs_StaticPropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension StaticPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_StaticPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_StaticPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticPropertyHolder_wrap") -fileprivate func _bjs_StaticPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_StaticPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_StaticPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_StaticPropertyHolder_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_DataProcessorManager_init") -@_cdecl("bjs_DataProcessorManager_init") -public func _bjs_DataProcessorManager_init(_ processor: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = DataProcessorManager(processor: AnyDataProcessor.bridgeJSLiftParameter(processor)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_incrementByAmount") -@_cdecl("bjs_DataProcessorManager_incrementByAmount") -public func _bjs_DataProcessorManager_incrementByAmount(_ _self: UnsafeMutableRawPointer, _ amount: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).incrementByAmount(_: Int.bridgeJSLiftParameter(amount)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_setProcessorLabel") -@_cdecl("bjs_DataProcessorManager_setProcessorLabel") -public func _bjs_DataProcessorManager_setProcessorLabel(_ _self: UnsafeMutableRawPointer, _ prefixBytes: Int32, _ prefixLength: Int32, _ suffixBytes: Int32, _ suffixLength: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorLabel(_: String.bridgeJSLiftParameter(prefixBytes, prefixLength), _: String.bridgeJSLiftParameter(suffixBytes, suffixLength)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_isProcessorEven") -@_cdecl("bjs_DataProcessorManager_isProcessorEven") -public func _bjs_DataProcessorManager_isProcessorEven(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).isProcessorEven() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_getProcessorLabel") -@_cdecl("bjs_DataProcessorManager_getProcessorLabel") -public func _bjs_DataProcessorManager_getProcessorLabel(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorLabel() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_getCurrentValue") -@_cdecl("bjs_DataProcessorManager_getCurrentValue") -public func _bjs_DataProcessorManager_getCurrentValue(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getCurrentValue() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_incrementBoth") -@_cdecl("bjs_DataProcessorManager_incrementBoth") -public func _bjs_DataProcessorManager_incrementBoth(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).incrementBoth() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_getBackupValue") -@_cdecl("bjs_DataProcessorManager_getBackupValue") -public func _bjs_DataProcessorManager_getBackupValue(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getBackupValue() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_hasBackup") -@_cdecl("bjs_DataProcessorManager_hasBackup") -public func _bjs_DataProcessorManager_hasBackup(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).hasBackup() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_getProcessorOptionalTag") -@_cdecl("bjs_DataProcessorManager_getProcessorOptionalTag") -public func _bjs_DataProcessorManager_getProcessorOptionalTag(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorOptionalTag() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_setProcessorOptionalTag") -@_cdecl("bjs_DataProcessorManager_setProcessorOptionalTag") -public func _bjs_DataProcessorManager_setProcessorOptionalTag(_ _self: UnsafeMutableRawPointer, _ tagIsSome: Int32, _ tagBytes: Int32, _ tagLength: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorOptionalTag(_: Optional.bridgeJSLiftParameter(tagIsSome, tagBytes, tagLength)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_getProcessorOptionalCount") -@_cdecl("bjs_DataProcessorManager_getProcessorOptionalCount") -public func _bjs_DataProcessorManager_getProcessorOptionalCount(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorOptionalCount() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_setProcessorOptionalCount") -@_cdecl("bjs_DataProcessorManager_setProcessorOptionalCount") -public func _bjs_DataProcessorManager_setProcessorOptionalCount(_ _self: UnsafeMutableRawPointer, _ countIsSome: Int32, _ countValue: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorOptionalCount(_: Optional.bridgeJSLiftParameter(countIsSome, countValue)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_getProcessorDirection") -@_cdecl("bjs_DataProcessorManager_getProcessorDirection") -public func _bjs_DataProcessorManager_getProcessorDirection(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorDirection() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_setProcessorDirection") -@_cdecl("bjs_DataProcessorManager_setProcessorDirection") -public func _bjs_DataProcessorManager_setProcessorDirection(_ _self: UnsafeMutableRawPointer, _ directionIsSome: Int32, _ directionValue: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorDirection(_: Optional.bridgeJSLiftParameter(directionIsSome, directionValue)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_getProcessorTheme") -@_cdecl("bjs_DataProcessorManager_getProcessorTheme") -public func _bjs_DataProcessorManager_getProcessorTheme(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorTheme() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_setProcessorTheme") -@_cdecl("bjs_DataProcessorManager_setProcessorTheme") -public func _bjs_DataProcessorManager_setProcessorTheme(_ _self: UnsafeMutableRawPointer, _ themeIsSome: Int32, _ themeBytes: Int32, _ themeLength: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorTheme(_: Optional.bridgeJSLiftParameter(themeIsSome, themeBytes, themeLength)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_getProcessorHttpStatus") -@_cdecl("bjs_DataProcessorManager_getProcessorHttpStatus") -public func _bjs_DataProcessorManager_getProcessorHttpStatus(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorHttpStatus() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_setProcessorHttpStatus") -@_cdecl("bjs_DataProcessorManager_setProcessorHttpStatus") -public func _bjs_DataProcessorManager_setProcessorHttpStatus(_ _self: UnsafeMutableRawPointer, _ statusIsSome: Int32, _ statusValue: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorHttpStatus(_: Optional.bridgeJSLiftParameter(statusIsSome, statusValue)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_getProcessorAPIResult") -@_cdecl("bjs_DataProcessorManager_getProcessorAPIResult") -public func _bjs_DataProcessorManager_getProcessorAPIResult(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).getProcessorAPIResult() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_setProcessorAPIResult") -@_cdecl("bjs_DataProcessorManager_setProcessorAPIResult") -public func _bjs_DataProcessorManager_setProcessorAPIResult(_ _self: UnsafeMutableRawPointer, _ apiResultIsSome: Int32, _ apiResultCaseId: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).setProcessorAPIResult(_: Optional.bridgeJSLiftParameter(apiResultIsSome, apiResultCaseId)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_processor_get") -@_cdecl("bjs_DataProcessorManager_processor_get") -public func _bjs_DataProcessorManager_processor_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).processor as! _BridgedSwiftProtocolExportable - return ret.bridgeJSLowerAsProtocolReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_processor_set") -@_cdecl("bjs_DataProcessorManager_processor_set") -public func _bjs_DataProcessorManager_processor_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).processor = AnyDataProcessor.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_backupProcessor_get") -@_cdecl("bjs_DataProcessorManager_backupProcessor_get") -public func _bjs_DataProcessorManager_backupProcessor_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor - if let ret { - _swift_js_return_optional_object(1, (ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) - } else { - _swift_js_return_optional_object(0, 0) - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_backupProcessor_set") -@_cdecl("bjs_DataProcessorManager_backupProcessor_set") -public func _bjs_DataProcessorManager_backupProcessor_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - DataProcessorManager.bridgeJSLiftParameter(_self).backupProcessor = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_DataProcessorManager_deinit") -@_cdecl("bjs_DataProcessorManager_deinit") -public func _bjs_DataProcessorManager_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension DataProcessorManager: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_DataProcessorManager_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_DataProcessorManager_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DataProcessorManager_wrap") -fileprivate func _bjs_DataProcessorManager_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_DataProcessorManager_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_DataProcessorManager_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_DataProcessorManager_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_SwiftDataProcessor_init") -@_cdecl("bjs_SwiftDataProcessor_init") -public func _bjs_SwiftDataProcessor_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = SwiftDataProcessor() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_increment") -@_cdecl("bjs_SwiftDataProcessor_increment") -public func _bjs_SwiftDataProcessor_increment(_ _self: UnsafeMutableRawPointer, _ amount: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).increment(by: Int.bridgeJSLiftParameter(amount)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_getValue") -@_cdecl("bjs_SwiftDataProcessor_getValue") -public func _bjs_SwiftDataProcessor_getValue(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getValue() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_setLabelElements") -@_cdecl("bjs_SwiftDataProcessor_setLabelElements") -public func _bjs_SwiftDataProcessor_setLabelElements(_ _self: UnsafeMutableRawPointer, _ labelPrefixBytes: Int32, _ labelPrefixLength: Int32, _ labelSuffixBytes: Int32, _ labelSuffixLength: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).setLabelElements(_: String.bridgeJSLiftParameter(labelPrefixBytes, labelPrefixLength), _: String.bridgeJSLiftParameter(labelSuffixBytes, labelSuffixLength)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_getLabel") -@_cdecl("bjs_SwiftDataProcessor_getLabel") -public func _bjs_SwiftDataProcessor_getLabel(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getLabel() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_isEven") -@_cdecl("bjs_SwiftDataProcessor_isEven") -public func _bjs_SwiftDataProcessor_isEven(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).isEven() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_processGreeter") -@_cdecl("bjs_SwiftDataProcessor_processGreeter") -public func _bjs_SwiftDataProcessor_processGreeter(_ _self: UnsafeMutableRawPointer, _ greeter: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).processGreeter(_: Greeter.bridgeJSLiftParameter(greeter)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_createGreeter") -@_cdecl("bjs_SwiftDataProcessor_createGreeter") -public func _bjs_SwiftDataProcessor_createGreeter(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).createGreeter() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_processOptionalGreeter") -@_cdecl("bjs_SwiftDataProcessor_processOptionalGreeter") -public func _bjs_SwiftDataProcessor_processOptionalGreeter(_ _self: UnsafeMutableRawPointer, _ greeterIsSome: Int32, _ greeterValue: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).processOptionalGreeter(_: Optional.bridgeJSLiftParameter(greeterIsSome, greeterValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_createOptionalGreeter") -@_cdecl("bjs_SwiftDataProcessor_createOptionalGreeter") -public func _bjs_SwiftDataProcessor_createOptionalGreeter(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).createOptionalGreeter() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_handleAPIResult") -@_cdecl("bjs_SwiftDataProcessor_handleAPIResult") -public func _bjs_SwiftDataProcessor_handleAPIResult(_ _self: UnsafeMutableRawPointer, _ resultIsSome: Int32, _ resultCaseId: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).handleAPIResult(_: Optional.bridgeJSLiftParameter(resultIsSome, resultCaseId)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_getAPIResult") -@_cdecl("bjs_SwiftDataProcessor_getAPIResult") -public func _bjs_SwiftDataProcessor_getAPIResult(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).getAPIResult() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_count_get") -@_cdecl("bjs_SwiftDataProcessor_count_get") -public func _bjs_SwiftDataProcessor_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).count - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_count_set") -@_cdecl("bjs_SwiftDataProcessor_count_set") -public func _bjs_SwiftDataProcessor_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_name_get") -@_cdecl("bjs_SwiftDataProcessor_name_get") -public func _bjs_SwiftDataProcessor_name_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).name - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_optionalTag_get") -@_cdecl("bjs_SwiftDataProcessor_optionalTag_get") -public func _bjs_SwiftDataProcessor_optionalTag_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTag - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_optionalTag_set") -@_cdecl("bjs_SwiftDataProcessor_optionalTag_set") -public func _bjs_SwiftDataProcessor_optionalTag_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTag = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_optionalCount_get") -@_cdecl("bjs_SwiftDataProcessor_optionalCount_get") -public func _bjs_SwiftDataProcessor_optionalCount_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalCount - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_optionalCount_set") -@_cdecl("bjs_SwiftDataProcessor_optionalCount_set") -public func _bjs_SwiftDataProcessor_optionalCount_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalCount = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_direction_get") -@_cdecl("bjs_SwiftDataProcessor_direction_get") -public func _bjs_SwiftDataProcessor_direction_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).direction - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_direction_set") -@_cdecl("bjs_SwiftDataProcessor_direction_set") -public func _bjs_SwiftDataProcessor_direction_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).direction = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_optionalTheme_get") -@_cdecl("bjs_SwiftDataProcessor_optionalTheme_get") -public func _bjs_SwiftDataProcessor_optionalTheme_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTheme - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_optionalTheme_set") -@_cdecl("bjs_SwiftDataProcessor_optionalTheme_set") -public func _bjs_SwiftDataProcessor_optionalTheme_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalTheme = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_httpStatus_get") -@_cdecl("bjs_SwiftDataProcessor_httpStatus_get") -public func _bjs_SwiftDataProcessor_httpStatus_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).httpStatus - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_httpStatus_set") -@_cdecl("bjs_SwiftDataProcessor_httpStatus_set") -public func _bjs_SwiftDataProcessor_httpStatus_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).httpStatus = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_apiResult_get") -@_cdecl("bjs_SwiftDataProcessor_apiResult_get") -public func _bjs_SwiftDataProcessor_apiResult_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).apiResult - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_apiResult_set") -@_cdecl("bjs_SwiftDataProcessor_apiResult_set") -public func _bjs_SwiftDataProcessor_apiResult_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueCaseId: Int32) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).apiResult = Optional.bridgeJSLiftParameter(valueIsSome, valueCaseId) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_helper_get") -@_cdecl("bjs_SwiftDataProcessor_helper_get") -public func _bjs_SwiftDataProcessor_helper_get(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).helper - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_helper_set") -@_cdecl("bjs_SwiftDataProcessor_helper_set") -public func _bjs_SwiftDataProcessor_helper_set(_ _self: UnsafeMutableRawPointer, _ value: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).helper = Greeter.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_optionalHelper_get") -@_cdecl("bjs_SwiftDataProcessor_optionalHelper_get") -public func _bjs_SwiftDataProcessor_optionalHelper_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalHelper - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_optionalHelper_set") -@_cdecl("bjs_SwiftDataProcessor_optionalHelper_set") -public func _bjs_SwiftDataProcessor_optionalHelper_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - SwiftDataProcessor.bridgeJSLiftParameter(_self).optionalHelper = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_SwiftDataProcessor_deinit") -@_cdecl("bjs_SwiftDataProcessor_deinit") -public func _bjs_SwiftDataProcessor_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension SwiftDataProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_SwiftDataProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_SwiftDataProcessor_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftDataProcessor_wrap") -fileprivate func _bjs_SwiftDataProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_SwiftDataProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_SwiftDataProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_SwiftDataProcessor_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessor") -@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessor") -public func _bjs_ProtocolReturnTests_static_createNativeProcessor() -> Int32 { - #if arch(wasm32) - let ret = ProtocolReturnTests.createNativeProcessor() as! _BridgedSwiftProtocolExportable - return ret.bridgeJSLowerAsProtocolReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessorOptional") -@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessorOptional") -public func _bjs_ProtocolReturnTests_static_createNativeProcessorOptional() -> Void { - #if arch(wasm32) - let ret = ProtocolReturnTests.createNativeProcessorOptional() - if let ret { - _swift_js_return_optional_object(1, (ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) - } else { - _swift_js_return_optional_object(0, 0) - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessorNil") -@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessorNil") -public func _bjs_ProtocolReturnTests_static_createNativeProcessorNil() -> Void { - #if arch(wasm32) - let ret = ProtocolReturnTests.createNativeProcessorNil() - if let ret { - _swift_js_return_optional_object(1, (ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) - } else { - _swift_js_return_optional_object(0, 0) - } - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessorArray") -@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessorArray") -public func _bjs_ProtocolReturnTests_static_createNativeProcessorArray() -> Void { - #if arch(wasm32) - let ret = ProtocolReturnTests.createNativeProcessorArray() - for __bjs_elem_ret in ret { - _swift_js_push_i32((__bjs_elem_ret as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) - } - _swift_js_push_i32(Int32(ret.count)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ProtocolReturnTests_static_createNativeProcessorDictionary") -@_cdecl("bjs_ProtocolReturnTests_static_createNativeProcessorDictionary") -public func _bjs_ProtocolReturnTests_static_createNativeProcessorDictionary() -> Void { - #if arch(wasm32) - let ret = ProtocolReturnTests.createNativeProcessorDictionary() - for __bjs_kv_ret in ret { - __bjs_kv_ret.key.bridgeJSStackPush() - _swift_js_push_i32((__bjs_kv_ret.value as! _BridgedSwiftProtocolExportable).bridgeJSLowerAsProtocolReturn()) - } - _swift_js_push_i32(Int32(ret.count)) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ProtocolReturnTests_deinit") -@_cdecl("bjs_ProtocolReturnTests_deinit") -public func _bjs_ProtocolReturnTests_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension ProtocolReturnTests: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_ProtocolReturnTests_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_ProtocolReturnTests_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ProtocolReturnTests_wrap") -fileprivate func _bjs_ProtocolReturnTests_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_ProtocolReturnTests_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_ProtocolReturnTests_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_ProtocolReturnTests_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_TextProcessor_init") -@_cdecl("bjs_TextProcessor_init") -public func _bjs_TextProcessor_init(_ transform: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = TextProcessor(transform: _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(transform)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_process") -@_cdecl("bjs_TextProcessor_process") -public func _bjs_TextProcessor_process(_ _self: UnsafeMutableRawPointer, _ textBytes: Int32, _ textLength: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).process(_: String.bridgeJSLiftParameter(textBytes, textLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processWithCustom") -@_cdecl("bjs_TextProcessor_processWithCustom") -public func _bjs_TextProcessor_processWithCustom(_ _self: UnsafeMutableRawPointer, _ textBytes: Int32, _ textLength: Int32, _ customTransform: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processWithCustom(_: String.bridgeJSLiftParameter(textBytes, textLength), customTransform: _BJS_Closure_20BridgeJSRuntimeTestsSiSSSd_SS.bridgeJSLift(customTransform)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_getTransform") -@_cdecl("bjs_TextProcessor_getTransform") -public func _bjs_TextProcessor_getTransform(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).getTransform() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processOptionalString") -@_cdecl("bjs_TextProcessor_processOptionalString") -public func _bjs_TextProcessor_processOptionalString(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalString(_: _BJS_Closure_20BridgeJSRuntimeTestsSqSS_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processOptionalInt") -@_cdecl("bjs_TextProcessor_processOptionalInt") -public func _bjs_TextProcessor_processOptionalInt(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalInt(_: _BJS_Closure_20BridgeJSRuntimeTestsSqSi_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processOptionalGreeter") -@_cdecl("bjs_TextProcessor_processOptionalGreeter") -public func _bjs_TextProcessor_processOptionalGreeter(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalGreeter(_: _BJS_Closure_20BridgeJSRuntimeTestsSq7GreeterC_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_makeOptionalStringFormatter") -@_cdecl("bjs_TextProcessor_makeOptionalStringFormatter") -public func _bjs_TextProcessor_makeOptionalStringFormatter(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalStringFormatter() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_makeOptionalGreeterCreator") -@_cdecl("bjs_TextProcessor_makeOptionalGreeterCreator") -public func _bjs_TextProcessor_makeOptionalGreeterCreator(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalGreeterCreator() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processDirection") -@_cdecl("bjs_TextProcessor_processDirection") -public func _bjs_TextProcessor_processDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processDirection(_: _BJS_Closure_20BridgeJSRuntimeTests9DirectionO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processTheme") -@_cdecl("bjs_TextProcessor_processTheme") -public func _bjs_TextProcessor_processTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processTheme(_: _BJS_Closure_20BridgeJSRuntimeTests5ThemeO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processHttpStatus") -@_cdecl("bjs_TextProcessor_processHttpStatus") -public func _bjs_TextProcessor_processHttpStatus(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processHttpStatus(_: _BJS_Closure_20BridgeJSRuntimeTests10HttpStatusO_Si.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processAPIResult") -@_cdecl("bjs_TextProcessor_processAPIResult") -public func _bjs_TextProcessor_processAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTests9APIResultO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_makeDirectionChecker") -@_cdecl("bjs_TextProcessor_makeDirectionChecker") -public func _bjs_TextProcessor_makeDirectionChecker(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDirectionChecker() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_makeThemeValidator") -@_cdecl("bjs_TextProcessor_makeThemeValidator") -public func _bjs_TextProcessor_makeThemeValidator(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeThemeValidator() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_makeStatusCodeExtractor") -@_cdecl("bjs_TextProcessor_makeStatusCodeExtractor") -public func _bjs_TextProcessor_makeStatusCodeExtractor(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeStatusCodeExtractor() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_makeAPIResultHandler") -@_cdecl("bjs_TextProcessor_makeAPIResultHandler") -public func _bjs_TextProcessor_makeAPIResultHandler(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeAPIResultHandler() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processOptionalDirection") -@_cdecl("bjs_TextProcessor_processOptionalDirection") -public func _bjs_TextProcessor_processOptionalDirection(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalDirection(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9DirectionO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processOptionalTheme") -@_cdecl("bjs_TextProcessor_processOptionalTheme") -public func _bjs_TextProcessor_processOptionalTheme(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalTheme(_: _BJS_Closure_20BridgeJSRuntimeTestsSq5ThemeO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processOptionalAPIResult") -@_cdecl("bjs_TextProcessor_processOptionalAPIResult") -public func _bjs_TextProcessor_processOptionalAPIResult(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalAPIResult(_: _BJS_Closure_20BridgeJSRuntimeTestsSq9APIResultO_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_makeOptionalDirectionFormatter") -@_cdecl("bjs_TextProcessor_makeOptionalDirectionFormatter") -public func _bjs_TextProcessor_makeOptionalDirectionFormatter(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeOptionalDirectionFormatter() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processDataProcessor") -@_cdecl("bjs_TextProcessor_processDataProcessor") -public func _bjs_TextProcessor_processDataProcessor(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processDataProcessor(_: _BJS_Closure_20BridgeJSRuntimeTests13DataProcessorP_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_makeDataProcessorFactory") -@_cdecl("bjs_TextProcessor_makeDataProcessorFactory") -public func _bjs_TextProcessor_makeDataProcessorFactory(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).makeDataProcessorFactory() - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_roundtripDataProcessor") -@_cdecl("bjs_TextProcessor_roundtripDataProcessor") -public func _bjs_TextProcessor_roundtripDataProcessor(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Int32 { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).roundtripDataProcessor(_: _BJS_Closure_20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP.bridgeJSLift(callback)) - return JSTypedClosure(ret).bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_processOptionalDataProcessor") -@_cdecl("bjs_TextProcessor_processOptionalDataProcessor") -public func _bjs_TextProcessor_processOptionalDataProcessor(_ _self: UnsafeMutableRawPointer, _ callback: Int32) -> Void { - #if arch(wasm32) - let ret = TextProcessor.bridgeJSLiftParameter(_self).processOptionalDataProcessor(_: _BJS_Closure_20BridgeJSRuntimeTestsSq13DataProcessorP_SS.bridgeJSLift(callback)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_TextProcessor_deinit") -@_cdecl("bjs_TextProcessor_deinit") -public func _bjs_TextProcessor_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension TextProcessor: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_TextProcessor_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_TextProcessor_wrap") -fileprivate func _bjs_TextProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_TextProcessor_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_TextProcessor_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_TextProcessor_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_IdentityTestSubject_init") -@_cdecl("bjs_IdentityTestSubject_init") -public func _bjs_IdentityTestSubject_init(_ value: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = IdentityTestSubject(value: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IdentityTestSubject_value_get") -@_cdecl("bjs_IdentityTestSubject_value_get") -public func _bjs_IdentityTestSubject_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).value - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IdentityTestSubject_value_set") -@_cdecl("bjs_IdentityTestSubject_value_set") -public func _bjs_IdentityTestSubject_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - IdentityTestSubject.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IdentityTestSubject_currentValue_get") -@_cdecl("bjs_IdentityTestSubject_currentValue_get") -public func _bjs_IdentityTestSubject_currentValue_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = IdentityTestSubject.bridgeJSLiftParameter(_self).currentValue - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_IdentityTestSubject_deinit") -@_cdecl("bjs_IdentityTestSubject_deinit") -public func _bjs_IdentityTestSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension IdentityTestSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_IdentityTestSubject_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IdentityTestSubject_wrap") -fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_IdentityTestSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_IdentityTestSubject_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_RetainLeakSubject_init") -@_cdecl("bjs_RetainLeakSubject_init") -public func _bjs_RetainLeakSubject_init(_ tag: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = RetainLeakSubject(tag: Int.bridgeJSLiftParameter(tag)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_RetainLeakSubject_tag_get") -@_cdecl("bjs_RetainLeakSubject_tag_get") -public func _bjs_RetainLeakSubject_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = RetainLeakSubject.bridgeJSLiftParameter(_self).tag - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_RetainLeakSubject_tag_set") -@_cdecl("bjs_RetainLeakSubject_tag_set") -public func _bjs_RetainLeakSubject_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - RetainLeakSubject.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_RetainLeakSubject_deinit") -@_cdecl("bjs_RetainLeakSubject_deinit") -public func _bjs_RetainLeakSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension RetainLeakSubject: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_RetainLeakSubject_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_RetainLeakSubject_wrap") -fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_RetainLeakSubject_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_RetainLeakSubject_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_ArrayIdentityElement_init") -@_cdecl("bjs_ArrayIdentityElement_init") -public func _bjs_ArrayIdentityElement_init(_ tag: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = ArrayIdentityElement(tag: Int.bridgeJSLiftParameter(tag)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArrayIdentityElement_tag_get") -@_cdecl("bjs_ArrayIdentityElement_tag_get") -public func _bjs_ArrayIdentityElement_tag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { - #if arch(wasm32) - let ret = ArrayIdentityElement.bridgeJSLiftParameter(_self).tag - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArrayIdentityElement_tag_set") -@_cdecl("bjs_ArrayIdentityElement_tag_set") -public func _bjs_ArrayIdentityElement_tag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { - #if arch(wasm32) - ArrayIdentityElement.bridgeJSLiftParameter(_self).tag = Int.bridgeJSLiftParameter(value) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_ArrayIdentityElement_deinit") -@_cdecl("bjs_ArrayIdentityElement_deinit") -public func _bjs_ArrayIdentityElement_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension ArrayIdentityElement: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_ArrayIdentityElement_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayIdentityElement_wrap") -fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_ArrayIdentityElement_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_ArrayIdentityElement_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_ArrayIdentityElement_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_OptionalHolder_init") -@_cdecl("bjs_OptionalHolder_init") -public func _bjs_OptionalHolder_init(_ nullableGreeterIsSome: Int32, _ nullableGreeterValue: UnsafeMutableRawPointer, _ undefinedNumberIsSome: Int32, _ undefinedNumberValue: Float64) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = OptionalHolder(nullableGreeter: Optional.bridgeJSLiftParameter(nullableGreeterIsSome, nullableGreeterValue), undefinedNumber: JSUndefinedOr.bridgeJSLiftParameter(undefinedNumberIsSome, undefinedNumberValue)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalHolder_nullableGreeter_get") -@_cdecl("bjs_OptionalHolder_nullableGreeter_get") -public func _bjs_OptionalHolder_nullableGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalHolder_nullableGreeter_set") -@_cdecl("bjs_OptionalHolder_nullableGreeter_set") -public func _bjs_OptionalHolder_nullableGreeter_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - OptionalHolder.bridgeJSLiftParameter(_self).nullableGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalHolder_undefinedNumber_get") -@_cdecl("bjs_OptionalHolder_undefinedNumber_get") -public func _bjs_OptionalHolder_undefinedNumber_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalHolder_undefinedNumber_set") -@_cdecl("bjs_OptionalHolder_undefinedNumber_set") -public func _bjs_OptionalHolder_undefinedNumber_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Float64) -> Void { - #if arch(wasm32) - OptionalHolder.bridgeJSLiftParameter(_self).undefinedNumber = JSUndefinedOr.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalHolder_deinit") -@_cdecl("bjs_OptionalHolder_deinit") -public func _bjs_OptionalHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension OptionalHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_OptionalHolder_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalHolder_wrap") -fileprivate func _bjs_OptionalHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_OptionalHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_OptionalHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_OptionalHolder_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_OptionalPropertyHolder_init") -@_cdecl("bjs_OptionalPropertyHolder_init") -public func _bjs_OptionalPropertyHolder_init(_ optionalNameIsSome: Int32, _ optionalNameBytes: Int32, _ optionalNameLength: Int32) -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = OptionalPropertyHolder(optionalName: Optional.bridgeJSLiftParameter(optionalNameIsSome, optionalNameBytes, optionalNameLength)) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_get") -@_cdecl("bjs_OptionalPropertyHolder_optionalName_get") -public func _bjs_OptionalPropertyHolder_optionalName_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalName_set") -@_cdecl("bjs_OptionalPropertyHolder_optionalName_set") -public func _bjs_OptionalPropertyHolder_optionalName_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueBytes: Int32, _ valueLength: Int32) -> Void { - #if arch(wasm32) - OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalName = Optional.bridgeJSLiftParameter(valueIsSome, valueBytes, valueLength) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_get") -@_cdecl("bjs_OptionalPropertyHolder_optionalAge_get") -public func _bjs_OptionalPropertyHolder_optionalAge_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalAge_set") -@_cdecl("bjs_OptionalPropertyHolder_optionalAge_set") -public func _bjs_OptionalPropertyHolder_optionalAge_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: Int32) -> Void { - #if arch(wasm32) - OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalAge = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_get") -@_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_get") -public func _bjs_OptionalPropertyHolder_optionalGreeter_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalPropertyHolder_optionalGreeter_set") -@_cdecl("bjs_OptionalPropertyHolder_optionalGreeter_set") -public func _bjs_OptionalPropertyHolder_optionalGreeter_set(_ _self: UnsafeMutableRawPointer, _ valueIsSome: Int32, _ valueValue: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - OptionalPropertyHolder.bridgeJSLiftParameter(_self).optionalGreeter = Optional.bridgeJSLiftParameter(valueIsSome, valueValue) - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_OptionalPropertyHolder_deinit") -@_cdecl("bjs_OptionalPropertyHolder_deinit") -public func _bjs_OptionalPropertyHolder_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension OptionalPropertyHolder: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_OptionalPropertyHolder_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalPropertyHolder_wrap") -fileprivate func _bjs_OptionalPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_OptionalPropertyHolder_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_OptionalPropertyHolder_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_OptionalPropertyHolder_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_Container_init") -@_cdecl("bjs_Container_init") -public func _bjs_Container_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let _tmp_config = Optional.bridgeJSLiftParameter() - let _tmp_location = DataPoint.bridgeJSLiftParameter() - let ret = Container(location: _tmp_location, config: _tmp_config) - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Container_location_get") -@_cdecl("bjs_Container_location_get") -public func _bjs_Container_location_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = Container.bridgeJSLiftParameter(_self).location - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Container_location_set") -@_cdecl("bjs_Container_location_set") -public func _bjs_Container_location_set(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Container.bridgeJSLiftParameter(_self).location = DataPoint.bridgeJSLiftParameter() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Container_config_get") -@_cdecl("bjs_Container_config_get") -public func _bjs_Container_config_get(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = Container.bridgeJSLiftParameter(_self).config - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Container_config_set") -@_cdecl("bjs_Container_config_set") -public func _bjs_Container_config_set(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Container.bridgeJSLiftParameter(_self).config = Optional.bridgeJSLiftParameter() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_Container_deinit") -@_cdecl("bjs_Container_deinit") -public func _bjs_Container_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension Container: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_Container_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_Container_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Container_wrap") -fileprivate func _bjs_Container_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_Container_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_Container_wrap_extern(pointer) -} - -@_expose(wasm, "bjs_LeakCheck_init") -@_cdecl("bjs_LeakCheck_init") -public func _bjs_LeakCheck_init() -> UnsafeMutableRawPointer { - #if arch(wasm32) - let ret = LeakCheck() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - -@_expose(wasm, "bjs_LeakCheck_deinit") -@_cdecl("bjs_LeakCheck_deinit") -public func _bjs_LeakCheck_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - Unmanaged.fromOpaque(pointer).release() - #else - fatalError("Only available on WebAssembly") - #endif -} - -extension LeakCheck: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { - public var jsValue: JSValue { - return .object(JSObject(id: UInt32(bitPattern: _bjs_LeakCheck_wrap(Unmanaged.passRetained(self).toOpaque())))) - } - public consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { - _bjs_LeakCheck_wrap(Unmanaged.passRetained(self).toOpaque()) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_LeakCheck_wrap") -fileprivate func _bjs_LeakCheck_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 -#else -fileprivate func _bjs_LeakCheck_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func _bjs_LeakCheck_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { - return _bjs_LeakCheck_wrap_extern(pointer) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayElementObject_init") -fileprivate func bjs_ArrayElementObject_init_extern(_ idBytes: Int32, _ idLength: Int32) -> Int32 -#else -fileprivate func bjs_ArrayElementObject_init_extern(_ idBytes: Int32, _ idLength: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArrayElementObject_init(_ idBytes: Int32, _ idLength: Int32) -> Int32 { - return bjs_ArrayElementObject_init_extern(idBytes, idLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArrayElementObject_id_get") -fileprivate func bjs_ArrayElementObject_id_get_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_ArrayElementObject_id_get_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArrayElementObject_id_get(_ self: Int32) -> Int32 { - return bjs_ArrayElementObject_id_get_extern(self) -} - -func _$ArrayElementObject_init(_ id: String) throws(JSException) -> JSObject { - let ret0 = id.bridgeJSWithLoweredParameter { (idBytes, idLength) in - let ret = bjs_ArrayElementObject_init(idBytes, idLength) - return ret - } - let ret = ret0 - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$ArrayElementObject_id_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_ArrayElementObject_id_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsIntArrayLength_static") -fileprivate func bjs_ArraySupportImports_jsIntArrayLength_static_extern() -> Int32 -#else -fileprivate func bjs_ArraySupportImports_jsIntArrayLength_static_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsIntArrayLength_static() -> Int32 { - return bjs_ArraySupportImports_jsIntArrayLength_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripIntArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripIntArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripIntArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripIntArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripIntArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripNumberArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripNumberArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripNumberArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripNumberArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripNumberArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripStringArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripStringArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripStringArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripStringArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripStringArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripBoolArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripBoolArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripBoolArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripBoolArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripBoolArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripJSValueArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripJSValueArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripJSValueArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripJSValueArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripJSValueArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripJSObjectArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripJSObjectArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripJSObjectArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripJSObjectArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripJSObjectArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripJSClassArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripJSClassArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripJSClassArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripJSClassArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripJSClassArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static") -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static() -> Void { - return bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsSumNumberArray_static") -fileprivate func bjs_ArraySupportImports_jsSumNumberArray_static_extern() -> Float64 -#else -fileprivate func bjs_ArraySupportImports_jsSumNumberArray_static_extern() -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsSumNumberArray_static() -> Float64 { - return bjs_ArraySupportImports_jsSumNumberArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_jsCreateNumberArray_static") -fileprivate func bjs_ArraySupportImports_jsCreateNumberArray_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_jsCreateNumberArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_jsCreateNumberArray_static() -> Void { - return bjs_ArraySupportImports_jsCreateNumberArray_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ArraySupportImports_runJsArraySupportTests_static") -fileprivate func bjs_ArraySupportImports_runJsArraySupportTests_static_extern() -> Void -#else -fileprivate func bjs_ArraySupportImports_runJsArraySupportTests_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ArraySupportImports_runJsArraySupportTests_static() -> Void { - return bjs_ArraySupportImports_runJsArraySupportTests_static_extern() -} - -func _$ArraySupportImports_jsIntArrayLength(_ items: [Int]) throws(JSException) -> Int { - let _ = items.bridgeJSLowerParameter() - let ret = bjs_ArraySupportImports_jsIntArrayLength_static() - if let error = _swift_js_take_exception() { - throw error - } - return Int.bridgeJSLiftReturn(ret) -} - -func _$ArraySupportImports_jsRoundTripIntArray(_ items: [Int]) throws(JSException) -> [Int] { - let _ = items.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripIntArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Int].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripNumberArray(_ values: [Double]) throws(JSException) -> [Double] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripNumberArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Double].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripStringArray(_ values: [String]) throws(JSException) -> [String] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripStringArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [String].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripBoolArray(_ values: [Bool]) throws(JSException) -> [Bool] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripBoolArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Bool].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripJSValueArray(_ v: [JSValue]) throws(JSException) -> [JSValue] { - let _ = v.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripJSValueArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [JSValue].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripJSObjectArray(_ values: [JSObject]) throws(JSException) -> [JSObject] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripJSObjectArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [JSObject].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripJSClassArray(_ values: [ArrayElementObject]) throws(JSException) -> [ArrayElementObject] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripJSClassArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [ArrayElementObject].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripOptionalIntArray(_ values: [Optional]) throws(JSException) -> [Optional] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripOptionalIntArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Optional].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripOptionalStringArray(_ values: [Optional]) throws(JSException) -> [Optional] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripOptionalStringArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Optional].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripOptionalBoolArray(_ values: [Optional]) throws(JSException) -> [Optional] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripOptionalBoolArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Optional].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripOptionalJSValueArray(_ values: [Optional]) throws(JSException) -> [Optional] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripOptionalJSValueArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Optional].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripOptionalJSObjectArray(_ values: [Optional]) throws(JSException) -> [Optional] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripOptionalJSObjectArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Optional].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsRoundTripOptionalJSClassArray(_ values: [Optional]) throws(JSException) -> [Optional] { - let _ = values.bridgeJSLowerParameter() - bjs_ArraySupportImports_jsRoundTripOptionalJSClassArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Optional].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_jsSumNumberArray(_ values: [Double]) throws(JSException) -> Double { - let _ = values.bridgeJSLowerParameter() - let ret = bjs_ArraySupportImports_jsSumNumberArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -func _$ArraySupportImports_jsCreateNumberArray() throws(JSException) -> [Double] { - bjs_ArraySupportImports_jsCreateNumberArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [Double].bridgeJSLiftReturn() -} - -func _$ArraySupportImports_runJsArraySupportTests() throws(JSException) -> Void { - bjs_ArraySupportImports_runJsArraySupportTests_static() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripVoid_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripVoid_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripVoid_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripVoid_static(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripVoid_static_extern(resolveRef, rejectRef) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripNumber_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripNumber_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Float64) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripNumber_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripNumber_static(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Float64) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripNumber_static_extern(resolveRef, rejectRef, v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripBool_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBool_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Int32) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBool_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBool_static(_ resolveRef: Int32, _ rejectRef: Int32, _ v: Int32) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripBool_static_extern(resolveRef, rejectRef, v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripString_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripString_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripString_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripString_static(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripString_static_extern(resolveRef, rejectRef, vBytes, vLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static_extern(resolveRef, rejectRef, vIsSome, vBytes, vLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vValue: Float64) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vValue: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static(_ resolveRef: Int32, _ rejectRef: Int32, _ vIsSome: Int32, _ vValue: Float64) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static_extern(resolveRef, rejectRef, vIsSome, vValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static_extern(resolveRef, rejectRef) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static_extern(resolveRef, rejectRef) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static_extern(resolveRef, rejectRef) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static") -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void -#else -fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static(_ resolveRef: Int32, _ rejectRef: Int32, _ vBytes: Int32, _ vLength: Int32) -> Void { - return bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static_extern(resolveRef, rejectRef, vBytes, vLength) -} - -func _$AsyncImportImports_jsAsyncRoundTripVoid() async throws(JSException) -> Void { - try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<() -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - bjs_AsyncImportImports_jsAsyncRoundTripVoid_static(resolveRef, rejectRef) - } -} - -func _$AsyncImportImports_jsAsyncRoundTripNumber(_ v: Double) async throws(JSException) -> Double { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending Double) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - let vValue = v.bridgeJSLowerParameter() - bjs_AsyncImportImports_jsAsyncRoundTripNumber_static(resolveRef, rejectRef, vValue) - } - return resolved -} - -func _$AsyncImportImports_jsAsyncRoundTripBool(_ v: Bool) async throws(JSException) -> Bool { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending Bool) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - let vValue = v.bridgeJSLowerParameter() - bjs_AsyncImportImports_jsAsyncRoundTripBool_static(resolveRef, rejectRef, vValue) - } - return resolved -} - -func _$AsyncImportImports_jsAsyncRoundTripString(_ v: String) async throws(JSException) -> String { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending String) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - v.bridgeJSWithLoweredParameter { (vBytes, vLength) in - bjs_AsyncImportImports_jsAsyncRoundTripString_static(resolveRef, rejectRef, vBytes, vLength) - } - } - return resolved -} - -func _$AsyncImportImports_jsAsyncRoundTripOptionalString(_ v: Optional) async throws(JSException) -> Optional { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending Optional) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - v.bridgeJSWithLoweredParameter { (vIsSome, vBytes, vLength) in - bjs_AsyncImportImports_jsAsyncRoundTripOptionalString_static(resolveRef, rejectRef, vIsSome, vBytes, vLength) - } - } - return resolved -} - -func _$AsyncImportImports_jsAsyncRoundTripOptionalNumber(_ v: Optional) async throws(JSException) -> Optional { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending Optional) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - let (vIsSome, vValue) = v.bridgeJSLowerParameter() - bjs_AsyncImportImports_jsAsyncRoundTripOptionalNumber_static(resolveRef, rejectRef, vIsSome, vValue) - } - return resolved -} - -func _$AsyncImportImports_jsAsyncRoundTripBoolArray(_ values: [Bool]) async throws(JSException) -> [Bool] { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending [Bool]) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - let _ = values.bridgeJSLowerParameter() - bjs_AsyncImportImports_jsAsyncRoundTripBoolArray_static(resolveRef, rejectRef) - } - return resolved -} - -func _$AsyncImportImports_jsAsyncRoundTripIntArray(_ values: [Double]) async throws(JSException) -> [Double] { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending [Double]) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - let _ = values.bridgeJSLowerParameter() - bjs_AsyncImportImports_jsAsyncRoundTripIntArray_static(resolveRef, rejectRef) - } - return resolved -} - -func _$AsyncImportImports_jsAsyncRoundTripStringArray(_ values: [String]) async throws(JSException) -> [String] { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending [String]) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - let _ = values.bridgeJSLowerParameter() - bjs_AsyncImportImports_jsAsyncRoundTripStringArray_static(resolveRef, rejectRef) - } - return resolved -} - -func _$AsyncImportImports_jsAsyncRoundTripFeatureFlag(_ v: FeatureFlag) async throws(JSException) -> FeatureFlag { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending FeatureFlag) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - v.bridgeJSWithLoweredParameter { (vBytes, vLength) in - bjs_AsyncImportImports_jsAsyncRoundTripFeatureFlag_static(resolveRef, rejectRef, vBytes, vLength) - } - } - return resolved -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyVoid_static") -fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static_extern(_ callback: Int32) -> Void -#else -fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static_extern(_ callback: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyVoid_static(_ callback: Int32) -> Void { - return bjs_ClosureSupportImports_jsApplyVoid_static_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyBool_static") -fileprivate func bjs_ClosureSupportImports_jsApplyBool_static_extern(_ callback: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsApplyBool_static_extern(_ callback: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyBool_static(_ callback: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsApplyBool_static_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyInt_static") -fileprivate func bjs_ClosureSupportImports_jsApplyInt_static_extern(_ value: Int32, _ transform: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsApplyInt_static_extern(_ value: Int32, _ transform: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyInt_static(_ value: Int32, _ transform: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsApplyInt_static_extern(value, transform) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyDouble_static") -fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static_extern(_ value: Float64, _ transform: Int32) -> Float64 -#else -fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static_extern(_ value: Float64, _ transform: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyDouble_static(_ value: Float64, _ transform: Int32) -> Float64 { - return bjs_ClosureSupportImports_jsApplyDouble_static_extern(value, transform) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyString_static") -fileprivate func bjs_ClosureSupportImports_jsApplyString_static_extern(_ valueBytes: Int32, _ valueLength: Int32, _ transform: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsApplyString_static_extern(_ valueBytes: Int32, _ valueLength: Int32, _ transform: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyString_static(_ valueBytes: Int32, _ valueLength: Int32, _ transform: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsApplyString_static_extern(valueBytes, valueLength, transform) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsApplyJSObject_static") -fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static_extern(_ value: Int32, _ transform: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static_extern(_ value: Int32, _ transform: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsApplyJSObject_static(_ value: Int32, _ transform: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsApplyJSObject_static_extern(value, transform) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsMakeIntToInt_static") -fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static_extern(_ base: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static_extern(_ base: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsMakeIntToInt_static(_ base: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsMakeIntToInt_static_extern(base) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsMakeDoubleToDouble_static") -fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static_extern(_ base: Float64) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static_extern(_ base: Float64) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsMakeDoubleToDouble_static(_ base: Float64) -> Int32 { - return bjs_ClosureSupportImports_jsMakeDoubleToDouble_static_extern(base) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsMakeStringToString_static") -fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static_extern(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static_extern(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsMakeStringToString_static(_ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsMakeStringToString_static_extern(prefixBytes, prefixLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallTwice_static") -fileprivate func bjs_ClosureSupportImports_jsCallTwice_static_extern(_ value: Int32, _ callback: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsCallTwice_static_extern(_ value: Int32, _ callback: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallTwice_static(_ value: Int32, _ callback: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsCallTwice_static_extern(value, callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallBinary_static") -fileprivate func bjs_ClosureSupportImports_jsCallBinary_static_extern(_ callback: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsCallBinary_static_extern(_ callback: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallBinary_static(_ callback: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsCallBinary_static_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallTriple_static") -fileprivate func bjs_ClosureSupportImports_jsCallTriple_static_extern(_ callback: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsCallTriple_static_extern(_ callback: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallTriple_static(_ callback: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsCallTriple_static_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallAfterRelease_static") -fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static_extern(_ callback: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static_extern(_ callback: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallAfterRelease_static(_ callback: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsCallAfterRelease_static_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsOptionalInvoke_static") -fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static_extern(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static_extern(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsOptionalInvoke_static(_ callbackIsSome: Int32, _ callbackFuncRef: Int32) -> Int32 { - return bjs_ClosureSupportImports_jsOptionalInvoke_static_extern(callbackIsSome, callbackFuncRef) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsStoreClosure_static") -fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static_extern(_ callback: Int32) -> Void -#else -fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static_extern(_ callback: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsStoreClosure_static(_ callback: Int32) -> Void { - return bjs_ClosureSupportImports_jsStoreClosure_static_extern(callback) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsCallStoredClosure_static") -fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static_extern() -> Void -#else -fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsCallStoredClosure_static() -> Void { - return bjs_ClosureSupportImports_jsCallStoredClosure_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_jsHeapCount_static") -fileprivate func bjs_ClosureSupportImports_jsHeapCount_static_extern() -> Int32 -#else -fileprivate func bjs_ClosureSupportImports_jsHeapCount_static_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_jsHeapCount_static() -> Int32 { - return bjs_ClosureSupportImports_jsHeapCount_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_ClosureSupportImports_runJsClosureSupportTests_static") -fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static_extern() -> Void -#else -fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_ClosureSupportImports_runJsClosureSupportTests_static() -> Void { - return bjs_ClosureSupportImports_runJsClosureSupportTests_static_extern() -} - -func _$ClosureSupportImports_jsApplyVoid(_ callback: JSTypedClosure<() -> Void>) throws(JSException) -> Void { - let callbackFuncRef = callback.bridgeJSLowerParameter() - bjs_ClosureSupportImports_jsApplyVoid_static(callbackFuncRef) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$ClosureSupportImports_jsApplyBool(_ callback: JSTypedClosure<() -> Bool>) throws(JSException) -> Bool { - let callbackFuncRef = callback.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsApplyBool_static(callbackFuncRef) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsApplyInt(_ value: Int, _ transform: JSTypedClosure<(Int) -> Int>) throws(JSException) -> Int { - let valueValue = value.bridgeJSLowerParameter() - let transformFuncRef = transform.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsApplyInt_static(valueValue, transformFuncRef) - if let error = _swift_js_take_exception() { - throw error - } - return Int.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsApplyDouble(_ value: Double, _ transform: JSTypedClosure<(Double) -> Double>) throws(JSException) -> Double { - let valueValue = value.bridgeJSLowerParameter() - let transformFuncRef = transform.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsApplyDouble_static(valueValue, transformFuncRef) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsApplyString(_ value: String, _ transform: JSTypedClosure<(String) -> String>) throws(JSException) -> String { - let ret0 = value.bridgeJSWithLoweredParameter { (valueBytes, valueLength) in - let transformFuncRef = transform.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsApplyString_static(valueBytes, valueLength, transformFuncRef) - return ret - } - let ret = ret0 - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsApplyJSObject(_ value: JSObject, _ transform: JSTypedClosure<(JSObject) -> JSObject>) throws(JSException) -> JSObject { - let valueValue = value.bridgeJSLowerParameter() - let transformFuncRef = transform.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsApplyJSObject_static(valueValue, transformFuncRef) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsMakeIntToInt(_ base: Int) throws(JSException) -> (Int) -> Int { - let baseValue = base.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsMakeIntToInt_static(baseValue) - if let error = _swift_js_take_exception() { - throw error - } - return _BJS_Closure_20BridgeJSRuntimeTestsSi_Si.bridgeJSLift(ret) -} - -func _$ClosureSupportImports_jsMakeDoubleToDouble(_ base: Double) throws(JSException) -> (Double) -> Double { - let baseValue = base.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsMakeDoubleToDouble_static(baseValue) - if let error = _swift_js_take_exception() { - throw error - } - return _BJS_Closure_20BridgeJSRuntimeTestsSd_Sd.bridgeJSLift(ret) -} - -func _$ClosureSupportImports_jsMakeStringToString(_ prefix: String) throws(JSException) -> (String) -> String { - let ret0 = prefix.bridgeJSWithLoweredParameter { (prefixBytes, prefixLength) in - let ret = bjs_ClosureSupportImports_jsMakeStringToString_static(prefixBytes, prefixLength) - return ret - } - let ret = ret0 - if let error = _swift_js_take_exception() { - throw error - } - return _BJS_Closure_20BridgeJSRuntimeTestsSS_SS.bridgeJSLift(ret) -} - -func _$ClosureSupportImports_jsCallTwice(_ value: Int, _ callback: JSTypedClosure<(Int) -> Void>) throws(JSException) -> Int { - let valueValue = value.bridgeJSLowerParameter() - let callbackFuncRef = callback.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsCallTwice_static(valueValue, callbackFuncRef) - if let error = _swift_js_take_exception() { - throw error - } - return Int.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsCallBinary(_ callback: JSTypedClosure<(Int, Int) -> Int>) throws(JSException) -> Int { - let callbackFuncRef = callback.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsCallBinary_static(callbackFuncRef) - if let error = _swift_js_take_exception() { - throw error - } - return Int.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsCallTriple(_ callback: JSTypedClosure<(Int, Int, Int) -> Int>) throws(JSException) -> Int { - let callbackFuncRef = callback.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsCallTriple_static(callbackFuncRef) - if let error = _swift_js_take_exception() { - throw error - } - return Int.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsCallAfterRelease(_ callback: JSTypedClosure<() -> Void>) throws(JSException) -> String { - let callbackFuncRef = callback.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsCallAfterRelease_static(callbackFuncRef) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsOptionalInvoke(_ callback: Optional Bool>>) throws(JSException) -> Bool { - let (callbackIsSome, callbackFuncRef) = callback.bridgeJSLowerParameter() - let ret = bjs_ClosureSupportImports_jsOptionalInvoke_static(callbackIsSome, callbackFuncRef) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_jsStoreClosure(_ callback: JSTypedClosure<() -> Void>) throws(JSException) -> Void { - let callbackFuncRef = callback.bridgeJSLowerParameter() - bjs_ClosureSupportImports_jsStoreClosure_static(callbackFuncRef) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$ClosureSupportImports_jsCallStoredClosure() throws(JSException) -> Void { - bjs_ClosureSupportImports_jsCallStoredClosure_static() - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$ClosureSupportImports_jsHeapCount() throws(JSException) -> Int { - let ret = bjs_ClosureSupportImports_jsHeapCount_static() - if let error = _swift_js_take_exception() { - throw error - } - return Int.bridgeJSLiftReturn(ret) -} - -func _$ClosureSupportImports_runJsClosureSupportTests() throws(JSException) -> Void { - bjs_ClosureSupportImports_runJsClosureSupportTests_static() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static") -fileprivate func bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static_extern() -> Void -#else -fileprivate func bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static() -> Void { - return bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static_extern() -} - -func _$DefaultArgumentImports_runJsDefaultArgumentTests() throws(JSException) -> Void { - bjs_DefaultArgumentImports_runJsDefaultArgumentTests_static() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static") -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static_extern() -> Void -#else -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static() -> Void { - return bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static") -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static_extern() -> Void -#else -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static() -> Void { - return bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static") -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static_extern() -> Void -#else -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static() -> Void { - return bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static") -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static_extern() -> Void -#else -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static() -> Void { - return bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static") -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static_extern() -> Void -#else -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static() -> Void { - return bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static") -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static_extern() -> Void -#else -fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static() -> Void { - return bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static_extern() -} - -func _$DictionarySupportImports_jsRoundTripDictionaryInt(_ values: [String: Int]) throws(JSException) -> [String: Int] { - let _ = values.bridgeJSLowerParameter() - bjs_DictionarySupportImports_jsRoundTripDictionaryInt_static() - if let error = _swift_js_take_exception() { - throw error - } - return [String: Int].bridgeJSLiftReturn() -} - -func _$DictionarySupportImports_jsRoundTripDictionaryBool(_ values: [String: Bool]) throws(JSException) -> [String: Bool] { - let _ = values.bridgeJSLowerParameter() - bjs_DictionarySupportImports_jsRoundTripDictionaryBool_static() - if let error = _swift_js_take_exception() { - throw error - } - return [String: Bool].bridgeJSLiftReturn() -} - -func _$DictionarySupportImports_jsRoundTripDictionaryDouble(_ values: [String: Double]) throws(JSException) -> [String: Double] { - let _ = values.bridgeJSLowerParameter() - bjs_DictionarySupportImports_jsRoundTripDictionaryDouble_static() - if let error = _swift_js_take_exception() { - throw error - } - return [String: Double].bridgeJSLiftReturn() -} - -func _$DictionarySupportImports_jsRoundTripDictionaryJSObject(_ values: [String: JSObject]) throws(JSException) -> [String: JSObject] { - let _ = values.bridgeJSLowerParameter() - bjs_DictionarySupportImports_jsRoundTripDictionaryJSObject_static() - if let error = _swift_js_take_exception() { - throw error - } - return [String: JSObject].bridgeJSLiftReturn() -} - -func _$DictionarySupportImports_jsRoundTripDictionaryJSValue(_ values: [String: JSValue]) throws(JSException) -> [String: JSValue] { - let _ = values.bridgeJSLowerParameter() - bjs_DictionarySupportImports_jsRoundTripDictionaryJSValue_static() - if let error = _swift_js_take_exception() { - throw error - } - return [String: JSValue].bridgeJSLiftReturn() -} - -func _$DictionarySupportImports_jsRoundTripDictionaryDoubleArray(_ values: [String: [Double]]) throws(JSException) -> [String: [Double]] { - let _ = values.bridgeJSLowerParameter() - bjs_DictionarySupportImports_jsRoundTripDictionaryDoubleArray_static() - if let error = _swift_js_take_exception() { - throw error - } - return [String: [Double]].bridgeJSLiftReturn() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Foo_init") -fileprivate func bjs_Foo_init_extern(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 -#else -fileprivate func bjs_Foo_init_extern(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Foo_init(_ valueBytes: Int32, _ valueLength: Int32) -> Int32 { - return bjs_Foo_init_extern(valueBytes, valueLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Foo_value_get") -fileprivate func bjs_Foo_value_get_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_Foo_value_get_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Foo_value_get(_ self: Int32) -> Int32 { - return bjs_Foo_value_get_extern(self) -} - -func _$Foo_init(_ value: String) throws(JSException) -> JSObject { - let ret0 = value.bridgeJSWithLoweredParameter { (valueBytes, valueLength) in - let ret = bjs_Foo_init(valueBytes, valueLength) - return ret - } - let ret = ret0 - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$Foo_value_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Foo_value_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_globalObject1_get") -fileprivate func bjs_globalObject1_get_extern() -> Void -#else -fileprivate func bjs_globalObject1_get_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_globalObject1_get() -> Void { - return bjs_globalObject1_get_extern() -} - -func _$globalObject1_get() throws(JSException) -> JSValue { - bjs_globalObject1_get() - if let error = _swift_js_take_exception() { - throw error - } - return JSValue.bridgeJSLiftReturn() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") -fileprivate func bjs_jsRoundTripVoid_extern() -> Void -#else -fileprivate func bjs_jsRoundTripVoid_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsRoundTripVoid() -> Void { - return bjs_jsRoundTripVoid_extern() -} - -func _$jsRoundTripVoid() throws(JSException) -> Void { - bjs_jsRoundTripVoid() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumber") -fileprivate func bjs_jsRoundTripNumber_extern(_ v: Float64) -> Float64 -#else -fileprivate func bjs_jsRoundTripNumber_extern(_ v: Float64) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { - return bjs_jsRoundTripNumber_extern(v) -} - -func _$jsRoundTripNumber(_ v: Double) throws(JSException) -> Double { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_jsRoundTripNumber(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBool") -fileprivate func bjs_jsRoundTripBool_extern(_ v: Int32) -> Int32 -#else -fileprivate func bjs_jsRoundTripBool_extern(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { - return bjs_jsRoundTripBool_extern(v) -} - -func _$jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_jsRoundTripBool(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripString") -fileprivate func bjs_jsRoundTripString_extern(_ vBytes: Int32, _ vLength: Int32) -> Int32 -#else -fileprivate func bjs_jsRoundTripString_extern(_ vBytes: Int32, _ vLength: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsRoundTripString(_ vBytes: Int32, _ vLength: Int32) -> Int32 { - return bjs_jsRoundTripString_extern(vBytes, vLength) -} - -func _$jsRoundTripString(_ v: String) throws(JSException) -> String { - let ret0 = v.bridgeJSWithLoweredParameter { (vBytes, vLength) in - let ret = bjs_jsRoundTripString(vBytes, vLength) - return ret - } - let ret = ret0 - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripJSValue") -fileprivate func bjs_jsRoundTripJSValue_extern(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void -#else -fileprivate func bjs_jsRoundTripJSValue_extern(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsRoundTripJSValue(_ vKind: Int32, _ vPayload1: Int32, _ vPayload2: Float64) -> Void { - return bjs_jsRoundTripJSValue_extern(vKind, vPayload1, vPayload2) -} - -func _$jsRoundTripJSValue(_ v: JSValue) throws(JSException) -> JSValue { - let (vKind, vPayload1, vPayload2) = v.bridgeJSLowerParameter() - bjs_jsRoundTripJSValue(vKind, vPayload1, vPayload2) - if let error = _swift_js_take_exception() { - throw error - } - return JSValue.bridgeJSLiftReturn() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") -fileprivate func bjs_jsThrowOrVoid_extern(_ shouldThrow: Int32) -> Void -#else -fileprivate func bjs_jsThrowOrVoid_extern(_ shouldThrow: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { - return bjs_jsThrowOrVoid_extern(shouldThrow) -} - -func _$jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void { - let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() - bjs_jsThrowOrVoid(shouldThrowValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrNumber") -fileprivate func bjs_jsThrowOrNumber_extern(_ shouldThrow: Int32) -> Float64 -#else -fileprivate func bjs_jsThrowOrNumber_extern(_ shouldThrow: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { - return bjs_jsThrowOrNumber_extern(shouldThrow) -} - -func _$jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double { - let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() - let ret = bjs_jsThrowOrNumber(shouldThrowValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrBool") -fileprivate func bjs_jsThrowOrBool_extern(_ shouldThrow: Int32) -> Int32 -#else -fileprivate func bjs_jsThrowOrBool_extern(_ shouldThrow: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { - return bjs_jsThrowOrBool_extern(shouldThrow) -} - -func _$jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool { - let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() - let ret = bjs_jsThrowOrBool(shouldThrowValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrString") -fileprivate func bjs_jsThrowOrString_extern(_ shouldThrow: Int32) -> Int32 -#else -fileprivate func bjs_jsThrowOrString_extern(_ shouldThrow: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { - return bjs_jsThrowOrString_extern(shouldThrow) -} - -func _$jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { - let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() - let ret = bjs_jsThrowOrString(shouldThrowValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripFeatureFlag") -fileprivate func bjs_jsRoundTripFeatureFlag_extern(_ flagBytes: Int32, _ flagLength: Int32) -> Int32 -#else -fileprivate func bjs_jsRoundTripFeatureFlag_extern(_ flagBytes: Int32, _ flagLength: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsRoundTripFeatureFlag(_ flagBytes: Int32, _ flagLength: Int32) -> Int32 { - return bjs_jsRoundTripFeatureFlag_extern(flagBytes, flagLength) -} - -func _$jsRoundTripFeatureFlag(_ flag: FeatureFlag) throws(JSException) -> FeatureFlag { - let ret0 = flag.bridgeJSWithLoweredParameter { (flagBytes, flagLength) in - let ret = bjs_jsRoundTripFeatureFlag(flagBytes, flagLength) - return ret - } - let ret = ret0 - if let error = _swift_js_take_exception() { - throw error - } - return FeatureFlag.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runAsyncWorks") -fileprivate func bjs_runAsyncWorks_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void -#else -fileprivate func bjs_runAsyncWorks_extern(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_runAsyncWorks(_ resolveRef: Int32, _ rejectRef: Int32) -> Void { - return bjs_runAsyncWorks_extern(resolveRef, rejectRef) -} - -func _$runAsyncWorks() async throws(JSException) -> Void { - try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<() -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - bjs_runAsyncWorks(resolveRef, rejectRef) - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_fetchWeatherData") -fileprivate func bjs_fetchWeatherData_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ cityBytes: Int32, _ cityLength: Int32) -> Void -#else -fileprivate func bjs_fetchWeatherData_extern(_ resolveRef: Int32, _ rejectRef: Int32, _ cityBytes: Int32, _ cityLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_fetchWeatherData(_ resolveRef: Int32, _ rejectRef: Int32, _ cityBytes: Int32, _ cityLength: Int32) -> Void { - return bjs_fetchWeatherData_extern(resolveRef, rejectRef, cityBytes, cityLength) -} - -func _$fetchWeatherData(_ city: String) async throws(JSException) -> WeatherData { - let resolved = try await _bjs_awaitPromise(makeResolveClosure: { - JSTypedClosure<(sending WeatherData) -> Void>($0) - }, makeRejectClosure: { - JSTypedClosure<(sending JSValue) -> Void>($0) - }) { resolveRef, rejectRef in - city.bridgeJSWithLoweredParameter { (cityBytes, cityLength) in - bjs_fetchWeatherData(resolveRef, rejectRef, cityBytes, cityLength) - } - } - return resolved -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__jsWeirdFunction") -fileprivate func bjs__jsWeirdFunction_extern() -> Float64 -#else -fileprivate func bjs__jsWeirdFunction_extern() -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs__jsWeirdFunction() -> Float64 { - return bjs__jsWeirdFunction_extern() -} - -func _$_jsWeirdFunction() throws(JSException) -> Double { - let ret = bjs__jsWeirdFunction() - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_parseInt") -fileprivate func bjs_parseInt_extern(_ stringBytes: Int32, _ stringLength: Int32) -> Float64 -#else -fileprivate func bjs_parseInt_extern(_ stringBytes: Int32, _ stringLength: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_parseInt(_ stringBytes: Int32, _ stringLength: Int32) -> Float64 { - return bjs_parseInt_extern(stringBytes, stringLength) -} - -func _$parseInt(_ string: String) throws(JSException) -> Double { - let ret0 = string.bridgeJSWithLoweredParameter { (stringBytes, stringLength) in - let ret = bjs_parseInt(stringBytes, stringLength) - return ret - } - let ret = ret0 - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") -fileprivate func bjs_JsGreeter_init_extern(_ nameBytes: Int32, _ nameLength: Int32, _ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_init_extern(_ nameBytes: Int32, _ nameLength: Int32, _ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JsGreeter_init(_ nameBytes: Int32, _ nameLength: Int32, _ prefixBytes: Int32, _ prefixLength: Int32) -> Int32 { - return bjs_JsGreeter_init_extern(nameBytes, nameLength, prefixBytes, prefixLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") -fileprivate func bjs_JsGreeter_name_get_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_name_get_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { - return bjs_JsGreeter_name_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_prefix_get") -fileprivate func bjs_JsGreeter_prefix_get_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_prefix_get_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { - return bjs_JsGreeter_prefix_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_set") -fileprivate func bjs_JsGreeter_name_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void -#else -fileprivate func bjs_JsGreeter_name_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - return bjs_JsGreeter_name_set_extern(self, newValueBytes, newValueLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") -fileprivate func bjs_JsGreeter_greet_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_greet_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { - return bjs_JsGreeter_greet_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_changeName") -fileprivate func bjs_JsGreeter_changeName_extern(_ self: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void -#else -fileprivate func bjs_JsGreeter_changeName_extern(_ self: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - return bjs_JsGreeter_changeName_extern(self, nameBytes, nameLength) -} - -func _$JsGreeter_init(_ name: String, _ prefix: String) throws(JSException) -> JSObject { - let ret0 = name.bridgeJSWithLoweredParameter { (nameBytes, nameLength) in - let ret1 = prefix.bridgeJSWithLoweredParameter { (prefixBytes, prefixLength) in - let ret = bjs_JsGreeter_init(nameBytes, nameLength, prefixBytes, prefixLength) - return ret - } - return ret1 - } - let ret = ret0 - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$JsGreeter_name_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_JsGreeter_name_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$JsGreeter_prefix_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_JsGreeter_prefix_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$JsGreeter_name_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - newValue.bridgeJSWithLoweredParameter { (newValueBytes, newValueLength) in - bjs_JsGreeter_name_set(selfValue, newValueBytes, newValueLength) - } - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$JsGreeter_greet(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_JsGreeter_greet(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$JsGreeter_changeName(_ self: JSObject, _ name: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - name.bridgeJSWithLoweredParameter { (nameBytes, nameLength) in - bjs_JsGreeter_changeName(selfValue, nameBytes, nameLength) - } - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_temperature_get") -fileprivate func bjs_WeatherData_temperature_get_extern(_ self: Int32) -> Float64 -#else -fileprivate func bjs_WeatherData_temperature_get_extern(_ self: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_WeatherData_temperature_get(_ self: Int32) -> Float64 { - return bjs_WeatherData_temperature_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_description_get") -fileprivate func bjs_WeatherData_description_get_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_WeatherData_description_get_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_WeatherData_description_get(_ self: Int32) -> Int32 { - return bjs_WeatherData_description_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_humidity_get") -fileprivate func bjs_WeatherData_humidity_get_extern(_ self: Int32) -> Float64 -#else -fileprivate func bjs_WeatherData_humidity_get_extern(_ self: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_WeatherData_humidity_get(_ self: Int32) -> Float64 { - return bjs_WeatherData_humidity_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_temperature_set") -fileprivate func bjs_WeatherData_temperature_set_extern(_ self: Int32, _ newValue: Float64) -> Void -#else -fileprivate func bjs_WeatherData_temperature_set_extern(_ self: Int32, _ newValue: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_WeatherData_temperature_set(_ self: Int32, _ newValue: Float64) -> Void { - return bjs_WeatherData_temperature_set_extern(self, newValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_description_set") -fileprivate func bjs_WeatherData_description_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void -#else -fileprivate func bjs_WeatherData_description_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_WeatherData_description_set(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - return bjs_WeatherData_description_set_extern(self, newValueBytes, newValueLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_WeatherData_humidity_set") -fileprivate func bjs_WeatherData_humidity_set_extern(_ self: Int32, _ newValue: Float64) -> Void -#else -fileprivate func bjs_WeatherData_humidity_set_extern(_ self: Int32, _ newValue: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_WeatherData_humidity_set(_ self: Int32, _ newValue: Float64) -> Void { - return bjs_WeatherData_humidity_set_extern(self, newValue) -} - -func _$WeatherData_temperature_get(_ self: JSObject) throws(JSException) -> Double { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_WeatherData_temperature_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -func _$WeatherData_description_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_WeatherData_description_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$WeatherData_humidity_get(_ self: JSObject) throws(JSException) -> Double { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_WeatherData_humidity_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -func _$WeatherData_temperature_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_WeatherData_temperature_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$WeatherData_description_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - newValue.bridgeJSWithLoweredParameter { (newValueBytes, newValueLength) in - bjs_WeatherData_description_set(selfValue, newValueBytes, newValueLength) - } - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$WeatherData_humidity_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_WeatherData_humidity_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__WeirdClass_init") -fileprivate func bjs__WeirdClass_init_extern() -> Int32 -#else -fileprivate func bjs__WeirdClass_init_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs__WeirdClass_init() -> Int32 { - return bjs__WeirdClass_init_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs__WeirdClass_method_with_dashes") -fileprivate func bjs__WeirdClass_method_with_dashes_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs__WeirdClass_method_with_dashes_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs__WeirdClass_method_with_dashes(_ self: Int32) -> Int32 { - return bjs__WeirdClass_method_with_dashes_extern(self) -} - -func _$_WeirdClass_init() throws(JSException) -> JSObject { - let ret = bjs__WeirdClass_init() - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$_WeirdClass_method_with_dashes(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs__WeirdClass_method_with_dashes(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_init") -fileprivate func bjs_StaticBox_init_extern(_ value: Float64) -> Int32 -#else -fileprivate func bjs_StaticBox_init_extern(_ value: Float64) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_StaticBox_init(_ value: Float64) -> Int32 { - return bjs_StaticBox_init_extern(value) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_create_static") -fileprivate func bjs_StaticBox_create_static_extern(_ value: Float64) -> Int32 -#else -fileprivate func bjs_StaticBox_create_static_extern(_ value: Float64) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_StaticBox_create_static(_ value: Float64) -> Int32 { - return bjs_StaticBox_create_static_extern(value) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_value_static") -fileprivate func bjs_StaticBox_value_static_extern() -> Float64 -#else -fileprivate func bjs_StaticBox_value_static_extern() -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_StaticBox_value_static() -> Float64 { - return bjs_StaticBox_value_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_makeDefault_static") -fileprivate func bjs_StaticBox_makeDefault_static_extern() -> Int32 -#else -fileprivate func bjs_StaticBox_makeDefault_static_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_StaticBox_makeDefault_static() -> Int32 { - return bjs_StaticBox_makeDefault_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_with_dashes_static") -fileprivate func bjs_StaticBox_with_dashes_static_extern() -> Int32 -#else -fileprivate func bjs_StaticBox_with_dashes_static_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_StaticBox_with_dashes_static() -> Int32 { - return bjs_StaticBox_with_dashes_static_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_StaticBox_value") -fileprivate func bjs_StaticBox_value_extern(_ self: Int32) -> Float64 -#else -fileprivate func bjs_StaticBox_value_extern(_ self: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_StaticBox_value(_ self: Int32) -> Float64 { - return bjs_StaticBox_value_extern(self) -} - -func _$StaticBox_init(_ value: Double) throws(JSException) -> JSObject { - let valueValue = value.bridgeJSLowerParameter() - let ret = bjs_StaticBox_init(valueValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$StaticBox_create(_ value: Double) throws(JSException) -> StaticBox { - let valueValue = value.bridgeJSLowerParameter() - let ret = bjs_StaticBox_create_static(valueValue) - if let error = _swift_js_take_exception() { - throw error - } - return StaticBox.bridgeJSLiftReturn(ret) -} - -func _$StaticBox_value() throws(JSException) -> Double { - let ret = bjs_StaticBox_value_static() - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -func _$StaticBox_makeDefault() throws(JSException) -> StaticBox { - let ret = bjs_StaticBox_makeDefault_static() - if let error = _swift_js_take_exception() { - throw error - } - return StaticBox.bridgeJSLiftReturn(ret) -} - -func _$StaticBox_with_dashes() throws(JSException) -> StaticBox { - let ret = bjs_StaticBox_with_dashes_static() - if let error = _swift_js_take_exception() { - throw error - } - return StaticBox.bridgeJSLiftReturn(ret) -} - -func _$StaticBox_value(_ self: JSObject) throws(JSException) -> Double { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_StaticBox_value(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_init") -fileprivate func bjs_Animal_init_extern(_ nameBytes: Int32, _ nameLength: Int32, _ age: Float64, _ isCat: Int32) -> Int32 -#else -fileprivate func bjs_Animal_init_extern(_ nameBytes: Int32, _ nameLength: Int32, _ age: Float64, _ isCat: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Animal_init(_ nameBytes: Int32, _ nameLength: Int32, _ age: Float64, _ isCat: Int32) -> Int32 { - return bjs_Animal_init_extern(nameBytes, nameLength, age, isCat) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_name_get") -fileprivate func bjs_Animal_name_get_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_Animal_name_get_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Animal_name_get(_ self: Int32) -> Int32 { - return bjs_Animal_name_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_age_get") -fileprivate func bjs_Animal_age_get_extern(_ self: Int32) -> Float64 -#else -fileprivate func bjs_Animal_age_get_extern(_ self: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Animal_age_get(_ self: Int32) -> Float64 { - return bjs_Animal_age_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_isCat_get") -fileprivate func bjs_Animal_isCat_get_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_Animal_isCat_get_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Animal_isCat_get(_ self: Int32) -> Int32 { - return bjs_Animal_isCat_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_name_set") -fileprivate func bjs_Animal_name_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void -#else -fileprivate func bjs_Animal_name_set_extern(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Animal_name_set(_ self: Int32, _ newValueBytes: Int32, _ newValueLength: Int32) -> Void { - return bjs_Animal_name_set_extern(self, newValueBytes, newValueLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_age_set") -fileprivate func bjs_Animal_age_set_extern(_ self: Int32, _ newValue: Float64) -> Void -#else -fileprivate func bjs_Animal_age_set_extern(_ self: Int32, _ newValue: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Animal_age_set(_ self: Int32, _ newValue: Float64) -> Void { - return bjs_Animal_age_set_extern(self, newValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_isCat_set") -fileprivate func bjs_Animal_isCat_set_extern(_ self: Int32, _ newValue: Int32) -> Void -#else -fileprivate func bjs_Animal_isCat_set_extern(_ self: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Animal_isCat_set(_ self: Int32, _ newValue: Int32) -> Void { - return bjs_Animal_isCat_set_extern(self, newValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_bark") -fileprivate func bjs_Animal_bark_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_Animal_bark_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Animal_bark(_ self: Int32) -> Int32 { - return bjs_Animal_bark_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_Animal_getIsCat") -fileprivate func bjs_Animal_getIsCat_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_Animal_getIsCat_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_Animal_getIsCat(_ self: Int32) -> Int32 { - return bjs_Animal_getIsCat_extern(self) -} - -func _$Animal_init(_ name: String, _ age: Double, _ isCat: Bool) throws(JSException) -> JSObject { - let ret0 = name.bridgeJSWithLoweredParameter { (nameBytes, nameLength) in - let ageValue = age.bridgeJSLowerParameter() - let isCatValue = isCat.bridgeJSLowerParameter() - let ret = bjs_Animal_init(nameBytes, nameLength, ageValue, isCatValue) - return ret - } - let ret = ret0 - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$Animal_name_get(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Animal_name_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$Animal_age_get(_ self: JSObject) throws(JSException) -> Double { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Animal_age_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -func _$Animal_isCat_get(_ self: JSObject) throws(JSException) -> Bool { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Animal_isCat_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -func _$Animal_name_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - newValue.bridgeJSWithLoweredParameter { (newValueBytes, newValueLength) in - bjs_Animal_name_set(selfValue, newValueBytes, newValueLength) - } - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$Animal_age_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_Animal_age_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$Animal_isCat_set(_ self: JSObject, _ newValue: Bool) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_Animal_isCat_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$Animal_bark(_ self: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Animal_bark(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -func _$Animal_getIsCat(_ self: JSObject) throws(JSException) -> Bool { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Animal_getIsCat(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static") -fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -> Void -#else -fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static() -> Void { - return bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static_extern() -} - -func _$IdentityModeSupportImports_runJsIdentityModeSupportTests() throws(JSException) -> Void { - bjs_IdentityModeSupportImports_runJsIdentityModeSupportTests_static() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsTranslatePoint") -fileprivate func bjs_jsTranslatePoint_extern(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 -#else -fileprivate func bjs_jsTranslatePoint_extern(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsTranslatePoint(_ point: Int32, _ dx: Int32, _ dy: Int32) -> Int32 { - return bjs_jsTranslatePoint_extern(point, dx, dy) -} - -func _$jsTranslatePoint(_ point: Point, _ dx: Int, _ dy: Int) throws(JSException) -> Point { - let pointObjectId = point.bridgeJSLowerParameter() - let dxValue = dx.bridgeJSLowerParameter() - let dyValue = dy.bridgeJSLowerParameter() - let ret = bjs_jsTranslatePoint(pointObjectId, dxValue, dyValue) - if let error = _swift_js_take_exception() { - throw error - } - return Point.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt_static_extern(_ v: Int32) -> Int32 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt_static_extern(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt_static(_ v: Int32) -> Int32 { - return bjs_IntegerTypesSupportImports_jsRoundTripInt_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt_static_extern(_ v: Int32) -> Int32 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt_static_extern(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt_static(_ v: Int32) -> Int32 { - return bjs_IntegerTypesSupportImports_jsRoundTripUInt_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt8_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt8_static_extern(_ v: Int32) -> Int32 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt8_static_extern(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt8_static(_ v: Int32) -> Int32 { - return bjs_IntegerTypesSupportImports_jsRoundTripInt8_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static_extern(_ v: Int32) -> Int32 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static_extern(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static(_ v: Int32) -> Int32 { - return bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt16_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt16_static_extern(_ v: Int32) -> Int32 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt16_static_extern(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt16_static(_ v: Int32) -> Int32 { - return bjs_IntegerTypesSupportImports_jsRoundTripInt16_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static_extern(_ v: Int32) -> Int32 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static_extern(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static(_ v: Int32) -> Int32 { - return bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt32_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt32_static_extern(_ v: Int32) -> Int32 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt32_static_extern(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt32_static(_ v: Int32) -> Int32 { - return bjs_IntegerTypesSupportImports_jsRoundTripInt32_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static_extern(_ v: Int32) -> Int32 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static_extern(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static(_ v: Int32) -> Int32 { - return bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripInt64_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt64_static_extern(_ v: Int64) -> Int64 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt64_static_extern(_ v: Int64) -> Int64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripInt64_static(_ v: Int64) -> Int64 { - return bjs_IntegerTypesSupportImports_jsRoundTripInt64_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static") -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static_extern(_ v: Int64) -> Int64 -#else -fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static_extern(_ v: Int64) -> Int64 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static(_ v: Int64) -> Int64 { - return bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static") -fileprivate func bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static_extern() -> Void -#else -fileprivate func bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static() -> Void { - return bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static_extern() -} - -func _$IntegerTypesSupportImports_jsRoundTripInt(_ v: Int) throws(JSException) -> Int { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return Int.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_jsRoundTripUInt(_ v: UInt) throws(JSException) -> UInt { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return UInt.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_jsRoundTripInt8(_ v: Int8) throws(JSException) -> Int8 { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt8_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return Int8.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_jsRoundTripUInt8(_ v: UInt8) throws(JSException) -> UInt8 { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt8_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return UInt8.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_jsRoundTripInt16(_ v: Int16) throws(JSException) -> Int16 { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt16_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return Int16.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_jsRoundTripUInt16(_ v: UInt16) throws(JSException) -> UInt16 { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt16_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return UInt16.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_jsRoundTripInt32(_ v: Int32) throws(JSException) -> Int32 { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt32_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return Int32.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_jsRoundTripUInt32(_ v: UInt32) throws(JSException) -> UInt32 { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt32_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return UInt32.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_jsRoundTripInt64(_ v: Int64) throws(JSException) -> Int64 { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripInt64_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return Int64.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_jsRoundTripUInt64(_ v: UInt64) throws(JSException) -> UInt64 { - let vValue = v.bridgeJSLowerParameter() - let ret = bjs_IntegerTypesSupportImports_jsRoundTripUInt64_static(vValue) - if let error = _swift_js_take_exception() { - throw error - } - return UInt64.bridgeJSLiftReturn(ret) -} - -func _$IntegerTypesSupportImports_runJsIntegerTypesSupportTests() throws(JSException) -> Void { - bjs_IntegerTypesSupportImports_runJsIntegerTypesSupportTests_static() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_init") -fileprivate func bjs_JSClassWithArrayMembers_init_extern() -> Int32 -#else -fileprivate func bjs_JSClassWithArrayMembers_init_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JSClassWithArrayMembers_init() -> Int32 { - return bjs_JSClassWithArrayMembers_init_extern() -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_numbers_get") -fileprivate func bjs_JSClassWithArrayMembers_numbers_get_extern(_ self: Int32) -> Void -#else -fileprivate func bjs_JSClassWithArrayMembers_numbers_get_extern(_ self: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JSClassWithArrayMembers_numbers_get(_ self: Int32) -> Void { - return bjs_JSClassWithArrayMembers_numbers_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_labels_get") -fileprivate func bjs_JSClassWithArrayMembers_labels_get_extern(_ self: Int32) -> Void -#else -fileprivate func bjs_JSClassWithArrayMembers_labels_get_extern(_ self: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JSClassWithArrayMembers_labels_get(_ self: Int32) -> Void { - return bjs_JSClassWithArrayMembers_labels_get_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_numbers_set") -fileprivate func bjs_JSClassWithArrayMembers_numbers_set_extern(_ self: Int32) -> Void -#else -fileprivate func bjs_JSClassWithArrayMembers_numbers_set_extern(_ self: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JSClassWithArrayMembers_numbers_set(_ self: Int32) -> Void { - return bjs_JSClassWithArrayMembers_numbers_set_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_labels_set") -fileprivate func bjs_JSClassWithArrayMembers_labels_set_extern(_ self: Int32) -> Void -#else -fileprivate func bjs_JSClassWithArrayMembers_labels_set_extern(_ self: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JSClassWithArrayMembers_labels_set(_ self: Int32) -> Void { - return bjs_JSClassWithArrayMembers_labels_set_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_concatNumbers") -fileprivate func bjs_JSClassWithArrayMembers_concatNumbers_extern(_ self: Int32) -> Void -#else -fileprivate func bjs_JSClassWithArrayMembers_concatNumbers_extern(_ self: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JSClassWithArrayMembers_concatNumbers(_ self: Int32) -> Void { - return bjs_JSClassWithArrayMembers_concatNumbers_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_concatLabels") -fileprivate func bjs_JSClassWithArrayMembers_concatLabels_extern(_ self: Int32) -> Void -#else -fileprivate func bjs_JSClassWithArrayMembers_concatLabels_extern(_ self: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JSClassWithArrayMembers_concatLabels(_ self: Int32) -> Void { - return bjs_JSClassWithArrayMembers_concatLabels_extern(self) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassWithArrayMembers_firstLabel") -fileprivate func bjs_JSClassWithArrayMembers_firstLabel_extern(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JSClassWithArrayMembers_firstLabel_extern(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JSClassWithArrayMembers_firstLabel(_ self: Int32) -> Int32 { - return bjs_JSClassWithArrayMembers_firstLabel_extern(self) -} - -func _$JSClassWithArrayMembers_init(_ numbers: [Int], _ labels: [String]) throws(JSException) -> JSObject { - let _ = labels.bridgeJSLowerParameter() - let _ = numbers.bridgeJSLowerParameter() - let ret = bjs_JSClassWithArrayMembers_init() - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -func _$JSClassWithArrayMembers_numbers_get(_ self: JSObject) throws(JSException) -> [Int] { - let selfValue = self.bridgeJSLowerParameter() - bjs_JSClassWithArrayMembers_numbers_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return [Int].bridgeJSLiftReturn() -} - -func _$JSClassWithArrayMembers_labels_get(_ self: JSObject) throws(JSException) -> [String] { - let selfValue = self.bridgeJSLowerParameter() - bjs_JSClassWithArrayMembers_labels_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return [String].bridgeJSLiftReturn() -} - -func _$JSClassWithArrayMembers_numbers_set(_ self: JSObject, _ newValue: [Int]) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let _ = newValue.bridgeJSLowerParameter() - bjs_JSClassWithArrayMembers_numbers_set(selfValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$JSClassWithArrayMembers_labels_set(_ self: JSObject, _ newValue: [String]) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let _ = newValue.bridgeJSLowerParameter() - bjs_JSClassWithArrayMembers_labels_set(selfValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -func _$JSClassWithArrayMembers_concatNumbers(_ self: JSObject, _ values: [Int]) throws(JSException) -> [Int] { - let selfValue = self.bridgeJSLowerParameter() - let _ = values.bridgeJSLowerParameter() - bjs_JSClassWithArrayMembers_concatNumbers(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return [Int].bridgeJSLiftReturn() -} - -func _$JSClassWithArrayMembers_concatLabels(_ self: JSObject, _ values: [String]) throws(JSException) -> [String] { - let selfValue = self.bridgeJSLowerParameter() - let _ = values.bridgeJSLowerParameter() - bjs_JSClassWithArrayMembers_concatLabels(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return [String].bridgeJSLiftReturn() -} - -func _$JSClassWithArrayMembers_firstLabel(_ self: JSObject, _ values: [String]) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let _ = values.bridgeJSLowerParameter() - let ret = bjs_JSClassWithArrayMembers_firstLabel(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static") -fileprivate func bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static_extern() -> Int32 -#else -fileprivate func bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static() -> Int32 { - return bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static_extern() -} - -func _$JSClassSupportImports_makeJSClassWithArrayMembers(_ numbers: [Int], _ labels: [String]) throws(JSException) -> JSClassWithArrayMembers { - let _ = labels.bridgeJSLowerParameter() - let _ = numbers.bridgeJSLowerParameter() - let ret = bjs_JSClassSupportImports_makeJSClassWithArrayMembers_static() - if let error = _swift_js_take_exception() { - throw error - } - return JSClassWithArrayMembers.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassInternal_init") -fileprivate func bjs_MyJSClassInternal_init_extern() -> Int32 -#else -fileprivate func bjs_MyJSClassInternal_init_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_MyJSClassInternal_init() -> Int32 { - return bjs_MyJSClassInternal_init_extern() -} - -func _$MyJSClassInternal_init() throws(JSException) -> JSObject { - let ret = bjs_MyJSClassInternal_init() - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassPublic_init") -fileprivate func bjs_MyJSClassPublic_init_extern() -> Int32 -#else -fileprivate func bjs_MyJSClassPublic_init_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_MyJSClassPublic_init() -> Int32 { - return bjs_MyJSClassPublic_init_extern() -} - -func _$MyJSClassPublic_init() throws(JSException) -> JSObject { - let ret = bjs_MyJSClassPublic_init() - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_MyJSClassPackage_init") -fileprivate func bjs_MyJSClassPackage_init_extern() -> Int32 -#else -fileprivate func bjs_MyJSClassPackage_init_extern() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_MyJSClassPackage_init() -> Int32 { - return bjs_MyJSClassPackage_init_extern() -} - -func _$MyJSClassPackage_init() throws(JSException) -> JSObject { - let ret = bjs_MyJSClassPackage_init() - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithPackageAccess") -fileprivate func bjs_jsFunctionWithPackageAccess_extern() -> Void -#else -fileprivate func bjs_jsFunctionWithPackageAccess_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsFunctionWithPackageAccess() -> Void { - return bjs_jsFunctionWithPackageAccess_extern() -} - -func _$jsFunctionWithPackageAccess() throws(JSException) -> Void { - bjs_jsFunctionWithPackageAccess() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithPublicAccess") -fileprivate func bjs_jsFunctionWithPublicAccess_extern() -> Void -#else -fileprivate func bjs_jsFunctionWithPublicAccess_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsFunctionWithPublicAccess() -> Void { - return bjs_jsFunctionWithPublicAccess_extern() -} - -func _$jsFunctionWithPublicAccess() throws(JSException) -> Void { - bjs_jsFunctionWithPublicAccess() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithInternalAccess") -fileprivate func bjs_jsFunctionWithInternalAccess_extern() -> Void -#else -fileprivate func bjs_jsFunctionWithInternalAccess_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsFunctionWithInternalAccess() -> Void { - return bjs_jsFunctionWithInternalAccess_extern() -} - -func _$jsFunctionWithInternalAccess() throws(JSException) -> Void { - bjs_jsFunctionWithInternalAccess() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithFilePrivateAccess") -fileprivate func bjs_jsFunctionWithFilePrivateAccess_extern() -> Void -#else -fileprivate func bjs_jsFunctionWithFilePrivateAccess_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsFunctionWithFilePrivateAccess() -> Void { - return bjs_jsFunctionWithFilePrivateAccess_extern() -} - -func _$jsFunctionWithFilePrivateAccess() throws(JSException) -> Void { - bjs_jsFunctionWithFilePrivateAccess() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsFunctionWithPrivateAccess") -fileprivate func bjs_jsFunctionWithPrivateAccess_extern() -> Void -#else -fileprivate func bjs_jsFunctionWithPrivateAccess_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_jsFunctionWithPrivateAccess() -> Void { - return bjs_jsFunctionWithPrivateAccess_extern() -} - -func _$jsFunctionWithPrivateAccess() throws(JSException) -> Void { - bjs_jsFunctionWithPrivateAccess() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void -#else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - return bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static_extern(valueIsSome, valueValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void -#else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static_extern(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static(_ valueIsSome: Int32, _ valueValue: Int32) -> Void { - return bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static_extern(valueIsSome, valueValue) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static_extern(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void -#else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static_extern(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - return bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static_extern(nameIsSome, nameBytes, nameLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static_extern(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void -#else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static_extern(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(_ nameIsSome: Int32, _ nameBytes: Int32, _ nameLength: Int32) -> Void { - return bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static_extern(nameIsSome, nameBytes, nameLength) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static_extern(_ v: Int32) -> Void -#else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static_extern(_ v: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static(_ v: Int32) -> Void { - return bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static_extern(_ v: Int32) -> Void -#else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static_extern(_ v: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static(_ v: Int32) -> Void { - return bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static_extern(_ v: Int32) -> Void -#else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static_extern(_ v: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static(_ v: Int32) -> Void { - return bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static") -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static_extern(_ v: Int32) -> Void -#else -fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static_extern(_ v: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static(_ v: Int32) -> Void { - return bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static_extern(v) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_OptionalSupportImports_runJsOptionalSupportTests_static") -fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static_extern() -> Void -#else -fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_OptionalSupportImports_runJsOptionalSupportTests_static() -> Void { - return bjs_OptionalSupportImports_runJsOptionalSupportTests_static_extern() -} - -func _$OptionalSupportImports_jsRoundTripOptionalNumberNull(_ value: Optional) throws(JSException) -> Optional { - let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() - bjs_OptionalSupportImports_jsRoundTripOptionalNumberNull_static(valueIsSome, valueValue) - if let error = _swift_js_take_exception() { - throw error - } - return Optional.bridgeJSLiftReturnFromSideChannel() -} - -func _$OptionalSupportImports_jsRoundTripOptionalNumberUndefined(_ value: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { - let (valueIsSome, valueValue) = value.bridgeJSLowerParameter() - bjs_OptionalSupportImports_jsRoundTripOptionalNumberUndefined_static(valueIsSome, valueValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() -} - -func _$OptionalSupportImports_jsRoundTripOptionalStringNull(_ name: Optional) throws(JSException) -> Optional { - name.bridgeJSWithLoweredParameter { (nameIsSome, nameBytes, nameLength) in - bjs_OptionalSupportImports_jsRoundTripOptionalStringNull_static(nameIsSome, nameBytes, nameLength) - } - if let error = _swift_js_take_exception() { - throw error - } - return Optional.bridgeJSLiftReturnFromSideChannel() -} - -func _$OptionalSupportImports_jsRoundTripOptionalStringUndefined(_ name: JSUndefinedOr) throws(JSException) -> JSUndefinedOr { - name.bridgeJSWithLoweredParameter { (nameIsSome, nameBytes, nameLength) in - bjs_OptionalSupportImports_jsRoundTripOptionalStringUndefined_static(nameIsSome, nameBytes, nameLength) - } - if let error = _swift_js_take_exception() { - throw error - } - return JSUndefinedOr.bridgeJSLiftReturnFromSideChannel() -} - -func _$OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull(_ v: Optional<[JSValue]>) throws(JSException) -> Optional<[JSValue]> { - let vIsSome = v.bridgeJSLowerParameter() - bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayNull_static(vIsSome) - if let error = _swift_js_take_exception() { - throw error - } - return Optional<[JSValue]>.bridgeJSLiftReturn() -} - -func _$OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined(_ v: JSUndefinedOr<[JSValue]>) throws(JSException) -> JSUndefinedOr<[JSValue]> { - let vIsSome = v.bridgeJSLowerParameter() - bjs_OptionalSupportImports_jsRoundTripOptionalJSValueArrayUndefined_static(vIsSome) - if let error = _swift_js_take_exception() { - throw error - } - return JSUndefinedOr<[JSValue]>.bridgeJSLiftReturn() -} - -func _$OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull(_ v: Optional<[String: String]>) throws(JSException) -> Optional<[String: String]> { - let vIsSome = v.bridgeJSLowerParameter() - bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryNull_static(vIsSome) - if let error = _swift_js_take_exception() { - throw error - } - return Optional<[String: String]>.bridgeJSLiftReturn() -} - -func _$OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined(_ v: JSUndefinedOr<[String: String]>) throws(JSException) -> JSUndefinedOr<[String: String]> { - let vIsSome = v.bridgeJSLowerParameter() - bjs_OptionalSupportImports_jsRoundTripOptionalStringToStringDictionaryUndefined_static(vIsSome) - if let error = _swift_js_take_exception() { - throw error - } - return JSUndefinedOr<[String: String]>.bridgeJSLiftReturn() -} - -func _$OptionalSupportImports_runJsOptionalSupportTests() throws(JSException) -> Void { - bjs_OptionalSupportImports_runJsOptionalSupportTests_static() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_gc") -fileprivate func bjs_gc_extern() -> Void -#else -fileprivate func bjs_gc_extern() -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_gc() -> Void { - return bjs_gc_extern() -} - -func _$gc() throws(JSException) -> Void { - bjs_gc() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsRoundTripGreeter_static") -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static_extern(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer -#else -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static_extern(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(_ greeter: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - return bjs_SwiftClassSupportImports_jsRoundTripGreeter_static_extern(greeter) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsRoundTripUUID_static") -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripUUID_static_extern(_ uuid: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer -#else -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripUUID_static_extern(_ uuid: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsRoundTripUUID_static(_ uuid: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - return bjs_SwiftClassSupportImports_jsRoundTripUUID_static_extern(uuid) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static") -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static_extern(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer -#else -fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static_extern(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static(_ greeterIsSome: Int32, _ greeterPointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { - return bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static_extern(greeterIsSome, greeterPointer) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static") -fileprivate func bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static_extern(_ value: UnsafeMutableRawPointer) -> Void -#else -fileprivate func bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static_extern(_ value: UnsafeMutableRawPointer) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static(_ value: UnsafeMutableRawPointer) -> Void { - return bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static_extern(value) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static") -fileprivate func bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static_extern(_ valueIsSome: Int32, _ valuePointer: UnsafeMutableRawPointer) -> Void -#else -fileprivate func bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static_extern(_ valueIsSome: Int32, _ valuePointer: UnsafeMutableRawPointer) -> Void { - fatalError("Only available on WebAssembly") -} -#endif -@inline(never) fileprivate func bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static(_ valueIsSome: Int32, _ valuePointer: UnsafeMutableRawPointer) -> Void { - return bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static_extern(valueIsSome, valuePointer) -} - -func _$SwiftClassSupportImports_jsRoundTripGreeter(_ greeter: Greeter) throws(JSException) -> Greeter { - let greeterPointer = greeter.bridgeJSLowerParameter() - let ret = bjs_SwiftClassSupportImports_jsRoundTripGreeter_static(greeterPointer) - if let error = _swift_js_take_exception() { - throw error - } - return Greeter.bridgeJSLiftReturn(ret) -} - -func _$SwiftClassSupportImports_jsRoundTripUUID(_ uuid: UUID) throws(JSException) -> UUID { - let uuidPointer = uuid.bridgeJSLowerParameter() - let ret = bjs_SwiftClassSupportImports_jsRoundTripUUID_static(uuidPointer) - if let error = _swift_js_take_exception() { - throw error - } - return UUID.bridgeJSLiftReturn(ret) -} - -func _$SwiftClassSupportImports_jsRoundTripOptionalGreeter(_ greeter: Optional) throws(JSException) -> Optional { - let (greeterIsSome, greeterPointer) = greeter.bridgeJSLowerParameter() - let ret = bjs_SwiftClassSupportImports_jsRoundTripOptionalGreeter_static(greeterIsSome, greeterPointer) - if let error = _swift_js_take_exception() { - throw error - } - return Optional.bridgeJSLiftReturn(ret) -} - -func _$SwiftClassSupportImports_jsConsumeLeakCheck(_ value: LeakCheck) throws(JSException) -> Void { - let valuePointer = value.bridgeJSLowerParameter() - bjs_SwiftClassSupportImports_jsConsumeLeakCheck_static(valuePointer) - if let error = _swift_js_take_exception() { - throw error - } +@inline(never) fileprivate func bjs_IdentityModeTestImports_runJsIdentityModeTests_static() -> Void { + return bjs_IdentityModeTestImports_runJsIdentityModeTests_static_extern() } -func _$SwiftClassSupportImports_jsConsumeOptionalLeakCheck(_ value: Optional) throws(JSException) -> Void { - let (valueIsSome, valuePointer) = value.bridgeJSLowerParameter() - bjs_SwiftClassSupportImports_jsConsumeOptionalLeakCheck_static(valueIsSome, valuePointer) +func _$IdentityModeTestImports_runJsIdentityModeTests() throws(JSException) -> Void { + bjs_IdentityModeTestImports_runJsIdentityModeTests_static() if let error = _swift_js_take_exception() { throw error } diff --git a/Tests/BridgeJSIdentityTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSIdentityTests/Generated/JavaScript/BridgeJS.json index ccca68ceb..d30ca00f8 100644 --- a/Tests/BridgeJSIdentityTests/Generated/JavaScript/BridgeJS.json +++ b/Tests/BridgeJSIdentityTests/Generated/JavaScript/BridgeJS.json @@ -2,329 +2,65 @@ "exported" : { "classes" : [ { - "methods" : [ - { - "abiName" : "bjs_ClosureSupportExports_static_makeIntToInt", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "makeIntToInt", - "parameters" : [ - { - "label" : "_", - "name" : "base", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - }, - "staticContext" : { - "className" : { - "_0" : "ClosureSupportExports" - } - } + "constructor" : { + "abiName" : "bjs_IdentityTestSubject_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false }, - { - "abiName" : "bjs_ClosureSupportExports_static_makeDoubleToDouble", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "makeDoubleToDouble", - "parameters" : [ - { - "label" : "_", - "name" : "base", - "type" : { - "double" : { - + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" } } } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "double" : { - - } - } - ], - "returnType" : { - "double" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - }, - "staticContext" : { - "className" : { - "_0" : "ClosureSupportExports" - } } - }, - { - "abiName" : "bjs_ClosureSupportExports_static_makeStringToString", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "makeStringToString", - "parameters" : [ - { - "label" : "_", - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { + ] + }, + "methods" : [ - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - }, - "staticContext" : { - "className" : { - "_0" : "ClosureSupportExports" - } - } - }, + ], + "name" : "IdentityTestSubject", + "properties" : [ { - "abiName" : "bjs_ClosureSupportExports_static_makeJSIntToInt", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "makeJSIntToInt", - "parameters" : [ - { - "label" : "_", - "name" : "base", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "closure" : { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "integer" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - }, - "staticContext" : { - "className" : { - "_0" : "ClosureSupportExports" - } - } - }, - { - "abiName" : "bjs_ClosureSupportExports_static_makeJSDoubleToDouble", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "makeJSDoubleToDouble", - "parameters" : [ - { - "label" : "_", - "name" : "base", - "type" : { - "double" : { - - } + "isSigned" : true, + "width" : "word" } } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "double" : { - - } - } - ], - "returnType" : { - "double" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - }, - "staticContext" : { - "className" : { - "_0" : "ClosureSupportExports" - } } }, { - "abiName" : "bjs_ClosureSupportExports_static_makeJSStringToString", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "makeJSStringToString", - "parameters" : [ - { - "label" : "_", - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { + "isReadonly" : true, + "isStatic" : false, + "name" : "currentValue", + "type" : { + "integer" : { "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - }, - "staticContext" : { - "className" : { - "_0" : "ClosureSupportExports" + "isSigned" : true, + "width" : "word" + } } } } ], - "name" : "ClosureSupportExports", - "properties" : [ - - ], - "swiftCallName" : "ClosureSupportExports" + "swiftCallName" : "IdentityTestSubject" }, { "constructor" : { - "abiName" : "bjs_DefaultArgumentConstructorDefaults_init", + "abiName" : "bjs_RetainLeakSubject_init", "effects" : { "isAsync" : false, "isStatic" : false, @@ -332,27 +68,8 @@ }, "parameters" : [ { - "defaultValue" : { - "string" : { - "_0" : "Default" - } - }, - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "int" : { - "_0" : 42 - } - }, - "label" : "count", - "name" : "count", + "label" : "tag", + "name" : "tag", "type" : { "integer" : { "_0" : { @@ -361,92 +78,18 @@ } } } - }, - { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "enabled", - "name" : "enabled", - "type" : { - "bool" : { - - } - } - }, - { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "success" - } - }, - "label" : "status", - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "tag", - "name" : "tag", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } } ] }, "methods" : [ - { - "abiName" : "bjs_DefaultArgumentConstructorDefaults_describe", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "describe", - "parameters" : [ - - ], - "returnType" : { - "string" : { - } - } - } ], - "name" : "DefaultArgumentConstructorDefaults", + "name" : "RetainLeakSubject", "properties" : [ { "isReadonly" : false, "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "count", + "name" : "tag", "type" : { "integer" : { "_0" : { @@ -455,48 +98,13 @@ } } } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "enabled", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "tag", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } } ], - "swiftCallName" : "DefaultArgumentConstructorDefaults" + "swiftCallName" : "RetainLeakSubject" }, { "constructor" : { - "abiName" : "bjs_Greeter_init", + "abiName" : "bjs_ArrayIdentityElement_init", "effects" : { "isAsync" : false, "isStatic" : false, @@ -504,308 +112,163 @@ }, "parameters" : [ { - "label" : "name", - "name" : "name", + "label" : "tag", + "name" : "tag", "type" : { - "string" : { - + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } } } } ] }, - "explicitAccessControl" : "public", "methods" : [ - { - "abiName" : "bjs_Greeter_greet", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - } - } - }, + ], + "name" : "ArrayIdentityElement", + "properties" : [ { - "abiName" : "bjs_Greeter_changeName", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "changeName", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } + "isReadonly" : false, + "isStatic" : false, + "name" : "tag", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" } } - ], - "returnType" : { - "void" : { - - } } - }, - { - "abiName" : "bjs_Greeter_greetWith", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greetWith", - "parameters" : [ - { - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "label" : "customGreeting", - "name" : "customGreeting", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - ], - "returnType" : { - "string" : { + } + ], + "swiftCallName" : "ArrayIdentityElement" + } + ], + "enums" : [ - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_Greeter_makeFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeFormatter", - "parameters" : [ - { - "label" : "suffix", - "name" : "suffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_Greeter_static_makeCreator", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "makeCreator", - "parameters" : [ - { - "label" : "defaultName", - "name" : "defaultName", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_7GreeterC", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_getSharedSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getSharedSubject", + "parameters" : [ - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - }, - "staticContext" : { - "className" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_Greeter_makeCustomGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeCustomGreeter", - "parameters" : [ + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "IdentityTestSubject" + } + } + }, + { + "abiName" : "bjs_resetSharedSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetSharedSubject", + "parameters" : [ - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - ], - "returnType" : { - "string" : { + ], + "returnType" : { + "void" : { - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_Greeter_greetEnthusiastically", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greetEnthusiastically", - "parameters" : [ + } + } + }, + { + "abiName" : "bjs_getRetainLeakSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getRetainLeakSubject", + "parameters" : [ - ], - "returnType" : { - "string" : { + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "RetainLeakSubject" + } + } + }, + { + "abiName" : "bjs_resetRetainLeakSubject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetRetainLeakSubject", + "parameters" : [ - } - } - }, - { - "abiName" : "bjs_Greeter_static_greetAnonymously", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "greetAnonymously", - "parameters" : [ + ], + "returnType" : { + "void" : { - ], - "returnType" : { - "string" : { + } + } + }, + { + "abiName" : "bjs_getRetainLeakDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getRetainLeakDeinits", + "parameters" : [ - } - }, - "staticContext" : { - "className" : { - "_0" : "Greeter" - } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" } } - ], - "name" : "Greeter", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { + } + }, + { + "abiName" : "bjs_resetRetainLeakDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetRetainLeakDeinits", + "parameters" : [ - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "prefix", - "type" : { - "string" : { + ], + "returnType" : { + "void" : { - } - } - }, + } + } + }, + { + "abiName" : "bjs_setupArrayPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setupArrayPool", + "parameters" : [ { - "isReadonly" : true, - "isStatic" : false, - "name" : "nameCount", + "label" : "_", + "name" : "count", "type" : { "integer" : { "_0" : { @@ -814,93 +277,48 @@ } } } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "defaultGreeting", - "staticContext" : { - "className" : { - "_0" : "Greeter" - } - }, - "type" : { - "string" : { - - } - } } ], - "swiftCallName" : "Greeter" + "returnType" : { + "void" : { + + } + } }, { - "methods" : [ - { - "abiName" : "bjs_Calculator_square", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "square", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } + "abiName" : "bjs_getArrayPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getArrayPool", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "ArrayIdentityElement" } } - }, + } + } + }, + { + "abiName" : "bjs_getArrayPoolElement", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getArrayPoolElement", + "parameters" : [ { - "abiName" : "bjs_Calculator_add", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { + "label" : "_", + "name" : "index", + "type" : { "integer" : { "_0" : { "isSigned" : true, @@ -910,19849 +328,85 @@ } } ], - "name" : "Calculator", - "properties" : [ - - ], - "swiftCallName" : "Calculator" - }, - { - "explicitAccessControl" : "internal", - "methods" : [ - - ], - "name" : "InternalGreeter", - "properties" : [ - - ], - "swiftCallName" : "InternalGreeter" - }, - { - "explicitAccessControl" : "public", - "methods" : [ - - ], - "name" : "PublicGreeter", - "properties" : [ - - ], - "swiftCallName" : "PublicGreeter" - }, - { - "explicitAccessControl" : "package", - "methods" : [ - - ], - "name" : "PackageGreeter", - "properties" : [ - - ], - "swiftCallName" : "PackageGreeter" - }, - { - "constructor" : { - "abiName" : "bjs_Utils_Converter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_Utils_Converter_toString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "toString", - "namespace" : [ - "Utils" - ], - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Converter", - "namespace" : [ - "Utils" - ], - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "precision", - "namespace" : [ - "Utils" - ], - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "Utils.Converter" - }, - { - "constructor" : { - "abiName" : "bjs_Networking_API_HTTPServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_Networking_API_HTTPServer_call", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "call", - "namespace" : [ - "Networking", - "API" - ], - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "HTTPServer", - "namespace" : [ - "Networking", - "API" - ], - "properties" : [ - - ], - "swiftCallName" : "Networking.API.HTTPServer" - }, - { - "constructor" : { - "abiName" : "bjs___Swift_Foundation_UUID_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs___Swift_Foundation_UUID_uuidString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "uuidString", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs___Swift_Foundation_UUID_static_fromValue", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "fromValue", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { + "returnType" : { + "nullable" : { + "_0" : { "swiftHeapObject" : { - "_0" : "UUID" - } - }, - "staticContext" : { - "className" : { - "_0" : "__Swift_Foundation_UUID" - } - } - } - ], - "name" : "UUID", - "namespace" : [ - "__Swift", - "Foundation" - ], - "properties" : [ - { - "isReadonly" : true, - "isStatic" : true, - "name" : "placeholder", - "staticContext" : { - "className" : { - "_0" : "__Swift_Foundation_UUID" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "UUID" - }, - { - "constructor" : { - "abiName" : "bjs_Networking_APIV2_Internal_TestServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_Networking_APIV2_Internal_TestServer_call", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "call", - "namespace" : [ - "Networking", - "APIV2", - "Internal" - ], - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Internal.SupportedMethod" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "TestServer", - "namespace" : [ - "Networking", - "APIV2", - "Internal" - ], - "properties" : [ - - ], - "swiftCallName" : "Internal.TestServer" - }, - { - "constructor" : { - "abiName" : "bjs_SimplePropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "SimplePropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "SimplePropertyHolder" - }, - { - "constructor" : { - "abiName" : "bjs_PropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "intValue", - "name" : "intValue", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "floatValue", - "name" : "floatValue", - "type" : { - "float" : { - - } - } - }, - { - "label" : "doubleValue", - "name" : "doubleValue", - "type" : { - "double" : { - - } - } - }, - { - "label" : "boolValue", - "name" : "boolValue", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "stringValue", - "name" : "stringValue", - "type" : { - "string" : { - - } - } - }, - { - "label" : "jsObject", - "name" : "jsObject", - "type" : { - "jsObject" : { - - } - } - }, - { - "label" : "sibling", - "name" : "sibling", - "type" : { - "swiftHeapObject" : { - "_0" : "SimplePropertyHolder" - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_PropertyHolder_getAllValues", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getAllValues", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "PropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "intValue", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "floatValue", - "type" : { - "float" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "doubleValue", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "boolValue", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "stringValue", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyInt", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyFloat", - "type" : { - "float" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyDouble", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyBool", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyString", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "jsObject", - "type" : { - "jsObject" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "sibling", - "type" : { - "swiftHeapObject" : { - "_0" : "SimplePropertyHolder" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "lazyValue", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "computedReadonly", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "computedReadWrite", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "observedProperty", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "PropertyHolder" - }, - { - "methods" : [ - { - "abiName" : "bjs_MathUtils_static_add", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - }, - { - "abiName" : "bjs_MathUtils_static_substract", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "substract", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - } - ], - "name" : "MathUtils", - "properties" : [ - - ], - "swiftCallName" : "MathUtils" - }, - { - "constructor" : { - "abiName" : "bjs_StaticPropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - - ], - "name" : "StaticPropertyHolder", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : true, - "name" : "staticConstant", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticVariable", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticString", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticBool", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticFloat", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "float" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticDouble", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "computedProperty", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "readOnlyComputed", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "optionalString", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "optionalInt", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "jsObjectProperty", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "jsObject" : { - - } - } - } - ], - "swiftCallName" : "StaticPropertyHolder" - }, - { - "constructor" : { - "abiName" : "bjs_DataProcessorManager_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "processor", - "name" : "processor", - "type" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_DataProcessorManager_incrementByAmount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "incrementByAmount", - "parameters" : [ - { - "label" : "_", - "name" : "amount", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorLabel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorLabel", - "parameters" : [ - { - "label" : "_", - "name" : "prefix", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "suffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_isProcessorEven", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "isProcessorEven", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorLabel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorLabel", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getCurrentValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getCurrentValue", - "parameters" : [ - - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_incrementBoth", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "incrementBoth", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getBackupValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getBackupValue", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_hasBackup", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "hasBackup", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorOptionalTag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorOptionalTag", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorOptionalTag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorOptionalTag", - "parameters" : [ - { - "label" : "_", - "name" : "tag", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorOptionalCount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorOptionalCount", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorOptionalCount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorOptionalCount", - "parameters" : [ - { - "label" : "_", - "name" : "count", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorDirection", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorDirection", - "parameters" : [ - { - "label" : "_", - "name" : "direction", - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorTheme", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorHttpStatus", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "status", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorAPIResult", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "apiResult", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "DataProcessorManager", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "processor", - "type" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "backupProcessor", - "type" : { - "nullable" : { - "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "DataProcessorManager" - }, - { - "constructor" : { - "abiName" : "bjs_SwiftDataProcessor_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_SwiftDataProcessor_increment", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "increment", - "parameters" : [ - { - "label" : "by", - "name" : "amount", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_getValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getValue", - "parameters" : [ - - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_setLabelElements", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setLabelElements", - "parameters" : [ - { - "label" : "_", - "name" : "labelPrefix", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "labelSuffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_getLabel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getLabel", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_isEven", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "isEven", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_processGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_createGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createGreeter", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_processOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "greeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_createOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createOptionalGreeter", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_handleAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "handleAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_getAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getAPIResult", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "SwiftDataProcessor", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "count", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalTag", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalCount", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "direction", - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalTheme", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "httpStatus", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "apiResult", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "helper", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalHelper", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "SwiftDataProcessor" - }, - { - "methods" : [ - { - "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessor", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "createNativeProcessor", - "parameters" : [ - - ], - "returnType" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - }, - "staticContext" : { - "className" : { - "_0" : "ProtocolReturnTests" - } - } - }, - { - "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessorOptional", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "createNativeProcessorOptional", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "className" : { - "_0" : "ProtocolReturnTests" - } - } - }, - { - "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessorNil", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "createNativeProcessorNil", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "className" : { - "_0" : "ProtocolReturnTests" - } - } - }, - { - "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessorArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "createNativeProcessorArray", - "parameters" : [ - - ], - "returnType" : { - "array" : { - "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - } - }, - "staticContext" : { - "className" : { - "_0" : "ProtocolReturnTests" - } - } - }, - { - "abiName" : "bjs_ProtocolReturnTests_static_createNativeProcessorDictionary", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "createNativeProcessorDictionary", - "parameters" : [ - - ], - "returnType" : { - "dictionary" : { - "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - } - }, - "staticContext" : { - "className" : { - "_0" : "ProtocolReturnTests" - } - } - } - ], - "name" : "ProtocolReturnTests", - "properties" : [ - - ], - "swiftCallName" : "ProtocolReturnTests" - }, - { - "constructor" : { - "abiName" : "bjs_TextProcessor_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "transform", - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_TextProcessor_process", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "process", - "parameters" : [ - { - "label" : "_", - "name" : "text", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processWithCustom", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processWithCustom", - "parameters" : [ - { - "label" : "_", - "name" : "text", - "type" : { - "string" : { - - } - } - }, - { - "label" : "customTransform", - "name" : "customTransform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSiSSSd_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - { - "string" : { - - } - }, - { - "double" : { - - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_getTransform", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTransform", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalString", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalInt", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSqSi_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeOptionalStringFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeOptionalStringFormatter", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeOptionalGreeterCreator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeOptionalGreeterCreator", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsy_Sq7GreeterC", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_processDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDirection", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests9DirectionO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "caseEnum" : { - "_0" : "Direction" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processTheme", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests5ThemeO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_TextProcessor_processAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeDirectionChecker", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeDirectionChecker", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests9DirectionO_Sb", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "caseEnum" : { - "_0" : "Direction" - } - } - ], - "returnType" : { - "bool" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeThemeValidator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeThemeValidator", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests5ThemeO_Sb", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - ], - "returnType" : { - "bool" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeStatusCodeExtractor", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeStatusCodeExtractor", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeAPIResultHandler", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultHandler", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalDirection", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalTheme", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq5ThemeO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq9APIResultO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeOptionalDirectionFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeOptionalDirectionFormatter", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_processDataProcessor", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDataProcessor", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests13DataProcessorP_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeDataProcessorFactory", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeDataProcessorFactory", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsy_13DataProcessorP", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - - ], - "returnType" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_roundtripDataProcessor", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripDataProcessor", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - ], - "returnType" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests13DataProcessorP_13DataProcessorP", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - ], - "returnType" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalDataProcessor", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalDataProcessor", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq13DataProcessorP_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "TextProcessor", - "properties" : [ - - ], - "swiftCallName" : "TextProcessor" - }, - { - "constructor" : { - "abiName" : "bjs_IdentityTestSubject_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "IdentityTestSubject", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "currentValue", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "IdentityTestSubject" - }, - { - "constructor" : { - "abiName" : "bjs_RetainLeakSubject_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "tag", - "name" : "tag", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "RetainLeakSubject", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "tag", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "RetainLeakSubject" - }, - { - "constructor" : { - "abiName" : "bjs_ArrayIdentityElement_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "tag", - "name" : "tag", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "ArrayIdentityElement", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "tag", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "ArrayIdentityElement" - }, - { - "constructor" : { - "abiName" : "bjs_OptionalHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "nullableGreeter", - "name" : "nullableGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "undefinedNumber", - "name" : "undefinedNumber", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "undefined" - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "OptionalHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "nullableGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "undefinedNumber", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "undefined" - } - } - } - ], - "swiftCallName" : "OptionalHolder" - }, - { - "constructor" : { - "abiName" : "bjs_OptionalPropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "optionalName", - "name" : "optionalName", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "OptionalPropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalName", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalAge", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "OptionalPropertyHolder" - }, - { - "constructor" : { - "abiName" : "bjs_Container_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "location", - "name" : "location", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - }, - { - "label" : "config", - "name" : "config", - "type" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - }, - "_1" : "null" - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "Container", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "location", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "config", - "type" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "Container" - }, - { - "constructor" : { - "abiName" : "bjs_LeakCheck_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "explicitAccessControl" : "public", - "methods" : [ - - ], - "name" : "LeakCheck", - "properties" : [ - - ], - "swiftCallName" : "LeakCheck" - } - ], - "enums" : [ - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "ArraySupportExports", - "staticMethods" : [ - { - "abiName" : "bjs_ArraySupportExports_static_roundTripIntArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripIntArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripStringArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripStringArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripDoubleArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripDoubleArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripBoolArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripBoolArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripUnsafeRawPointerArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUnsafeRawPointerArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripUnsafeMutableRawPointerArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUnsafeMutableRawPointerArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOpaquePointerArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOpaquePointerArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripUnsafePointerArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUnsafePointerArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripUnsafeMutablePointerArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUnsafeMutablePointerArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripJSValueArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripJSValueArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripJSObjectArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripJSObjectArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "jsObject" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "jsObject" : { - - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripCaseEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripCaseEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripStringRawValueEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripStringRawValueEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripIntRawValueEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripIntRawValueEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripInt64RawValueEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripInt64RawValueEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripUInt64RawValueEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUInt64RawValueEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripStructArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripStructArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripSwiftClassArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripSwiftClassArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripNamespacedSwiftClassArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripNamespacedSwiftClassArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripProtocolArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripProtocolArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "swiftProtocol" : { - "_0" : "ArrayElementProtocol" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "swiftProtocol" : { - "_0" : "ArrayElementProtocol" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripJSClassArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripJSClassArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "jsObject" : { - "_0" : "ArrayElementObject" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "jsObject" : { - "_0" : "ArrayElementObject" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalIntArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalIntArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalStringArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalStringArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalJSObjectArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalJSObjectArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalCaseEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalCaseEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalStringRawValueEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalStringRawValueEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalIntRawValueEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalIntRawValueEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalInt64RawValueEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalInt64RawValueEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalUInt64RawValueEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalUInt64RawValueEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalStructArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalStructArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalSwiftClassArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalSwiftClassArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripOptionalJSClassArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalJSClassArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "ArrayElementObject" - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "ArrayElementObject" - } - }, - "_1" : "null" - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripNestedIntArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripNestedIntArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripNestedStringArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripNestedStringArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripNestedDoubleArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripNestedDoubleArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripNestedBoolArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripNestedBoolArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripNestedStructArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripNestedStructArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripNestedCaseEnumArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripNestedCaseEnumArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_roundTripNestedSwiftClassArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripNestedSwiftClassArray", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_multiArrayFirst", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "multiArrayFirst", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "a", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "label" : "_", - "name" : "b", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_multiArraySecond", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "multiArraySecond", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "a", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "label" : "_", - "name" : "b", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_multiOptionalArrayFirst", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "multiOptionalArrayFirst", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "a", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - }, - "_1" : "null" - } - } - }, - { - "label" : "_", - "name" : "b", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - }, - { - "abiName" : "bjs_ArraySupportExports_static_multiOptionalArraySecond", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "multiOptionalArraySecond", - "namespace" : [ - "ArraySupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "a", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - }, - "_1" : "null" - } - } - }, - { - "label" : "_", - "name" : "b", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "ArraySupportExports" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "ArraySupportExports", - "tsFullPath" : "ArraySupportExports" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "DefaultArgumentExports", - "staticMethods" : [ - { - "abiName" : "bjs_DefaultArgumentExports_static_testStringDefault", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testStringDefault", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Hello World" - } - }, - "label" : "message", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_testIntDefault", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testIntDefault", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "int" : { - "_0" : 42 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_testBoolDefault", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testBoolDefault", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "flag", - "name" : "flag", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_testOptionalDefault", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testOptionalDefault", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "name", - "name" : "name", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_testMultipleDefaults", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testMultipleDefaults", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Default Title" - } - }, - "label" : "title", - "name" : "title", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "int" : { - "_0" : -10 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : false - } - }, - "label" : "enabled", - "name" : "enabled", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_testSimpleEnumDefault", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testSimpleEnumDefault", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "success" - } - }, - "label" : "status", - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_testDirectionDefault", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testDirectionDefault", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Direction", - "_1" : "north" - } - }, - "label" : "direction", - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_testRawStringEnumDefault", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testRawStringEnumDefault", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Theme", - "_1" : "light" - } - }, - "label" : "theme", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_testComplexInit", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testComplexInit", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "objectWithArguments" : { - "_0" : "Greeter", - "_1" : [ - { - "string" : { - "_0" : "DefaultGreeter" - } - } - ] - } - }, - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_testEmptyInit", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "testEmptyInit", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "object" : { - "_0" : "StaticPropertyHolder" - } - }, - "label" : "_", - "name" : "object", - "type" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_createConstructorDefaults", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "createConstructorDefaults", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Default" - } - }, - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "int" : { - "_0" : 42 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "enabled", - "name" : "enabled", - "type" : { - "bool" : { - - } - } - }, - { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "success" - } - }, - "label" : "status", - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "tag", - "name" : "tag", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "DefaultArgumentConstructorDefaults" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_describeConstructorDefaults", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "describeConstructorDefaults", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "DefaultArgumentConstructorDefaults" - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_arrayWithDefault", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "arrayWithDefault", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "array" : { - "_0" : [ - { - "int" : { - "_0" : 1 - } - }, - { - "int" : { - "_0" : 2 - } - }, - { - "int" : { - "_0" : 3 - } - } - ] - } - }, - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_arrayWithOptionalDefault", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "arrayWithOptionalDefault", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "_", - "name" : "values", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - }, - { - "abiName" : "bjs_DefaultArgumentExports_static_arrayMixedDefaults", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "arrayMixedDefaults", - "namespace" : [ - "DefaultArgumentExports" - ], - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Sum" - } - }, - "label" : "prefix", - "name" : "prefix", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "array" : { - "_0" : [ - { - "int" : { - "_0" : 10 - } - }, - { - "int" : { - "_0" : 20 - } - } - ] - } - }, - "label" : "values", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "defaultValue" : { - "string" : { - "_0" : "!" - } - }, - "label" : "suffix", - "name" : "suffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "DefaultArgumentExports" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "DefaultArgumentExports", - "tsFullPath" : "DefaultArgumentExports" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "north" - }, - { - "associatedValues" : [ - - ], - "name" : "south" - }, - { - "associatedValues" : [ - - ], - "name" : "east" - }, - { - "associatedValues" : [ - - ], - "name" : "west" - } - ], - "emitStyle" : "const", - "name" : "Direction", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Direction", - "tsFullPath" : "Direction" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "loading" - }, - { - "associatedValues" : [ - - ], - "name" : "success" - }, - { - "associatedValues" : [ - - ], - "name" : "error" - } - ], - "emitStyle" : "const", - "name" : "Status", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Status", - "tsFullPath" : "Status" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "light", - "rawValue" : "light" - }, - { - "associatedValues" : [ - - ], - "name" : "dark", - "rawValue" : "dark" - }, - { - "associatedValues" : [ - - ], - "name" : "auto", - "rawValue" : "auto" - } - ], - "emitStyle" : "const", - "name" : "Theme", - "rawType" : "String", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Theme", - "tsFullPath" : "Theme" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "ok", - "rawValue" : "200" - }, - { - "associatedValues" : [ - - ], - "name" : "notFound", - "rawValue" : "404" - }, - { - "associatedValues" : [ - - ], - "name" : "serverError", - "rawValue" : "500" - }, - { - "associatedValues" : [ - - ], - "name" : "unknown", - "rawValue" : "-1" - } - ], - "emitStyle" : "const", - "name" : "HttpStatus", - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "HttpStatus", - "tsFullPath" : "HttpStatus" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "tiny", - "rawValue" : "1024" - }, - { - "associatedValues" : [ - - ], - "name" : "small", - "rawValue" : "10240" - }, - { - "associatedValues" : [ - - ], - "name" : "medium", - "rawValue" : "102400" - }, - { - "associatedValues" : [ - - ], - "name" : "large", - "rawValue" : "1048576" - } - ], - "emitStyle" : "const", - "name" : "FileSize", - "rawType" : "Int64", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "FileSize", - "tsFullPath" : "FileSize" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "none", - "rawValue" : "0" - }, - { - "associatedValues" : [ - - ], - "name" : "active", - "rawValue" : "9876543210" - }, - { - "associatedValues" : [ - - ], - "name" : "expired", - "rawValue" : "1234567890" - } - ], - "emitStyle" : "const", - "name" : "SessionId", - "rawType" : "UInt64", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "SessionId", - "tsFullPath" : "SessionId" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "rough", - "rawValue" : "0.1" - }, - { - "associatedValues" : [ - - ], - "name" : "normal", - "rawValue" : "0.01" - }, - { - "associatedValues" : [ - - ], - "name" : "fine", - "rawValue" : "0.001" - } - ], - "emitStyle" : "const", - "name" : "Precision", - "rawType" : "Float", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Precision", - "tsFullPath" : "Precision" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "quarter", - "rawValue" : "0.25" - }, - { - "associatedValues" : [ - - ], - "name" : "half", - "rawValue" : "0.5" - }, - { - "associatedValues" : [ - - ], - "name" : "golden", - "rawValue" : "1.618" - } - ], - "emitStyle" : "const", - "name" : "Ratio", - "rawType" : "Double", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Ratio", - "tsFullPath" : "Ratio" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "north" - }, - { - "associatedValues" : [ - - ], - "name" : "south" - }, - { - "associatedValues" : [ - - ], - "name" : "east" - }, - { - "associatedValues" : [ - - ], - "name" : "west" - } - ], - "emitStyle" : "tsEnum", - "name" : "TSDirection", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "TSDirection", - "tsFullPath" : "TSDirection" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "light", - "rawValue" : "light" - }, - { - "associatedValues" : [ - - ], - "name" : "dark", - "rawValue" : "dark" - }, - { - "associatedValues" : [ - - ], - "name" : "auto", - "rawValue" : "auto" - } - ], - "emitStyle" : "tsEnum", - "name" : "TSTheme", - "rawType" : "String", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "TSTheme", - "tsFullPath" : "TSTheme" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Utils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utils", - "tsFullPath" : "Utils" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "StringUtils", - "namespace" : [ - "Utils" - ], - "staticMethods" : [ - { - "abiName" : "bjs_Utils_StringUtils_static_uppercase", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "uppercase", - "namespace" : [ - "Utils", - "StringUtils" - ], - "parameters" : [ - { - "label" : "_", - "name" : "text", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "Utils.StringUtils" - } - } - }, - { - "abiName" : "bjs_Utils_StringUtils_static_lowercase", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "lowercase", - "namespace" : [ - "Utils", - "StringUtils" - ], - "parameters" : [ - { - "label" : "_", - "name" : "text", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "Utils.StringUtils" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utils.StringUtils", - "tsFullPath" : "Utils.StringUtils" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Networking", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Networking", - "tsFullPath" : "Networking" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "API", - "namespace" : [ - "Networking" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Networking.API", - "tsFullPath" : "Networking.API" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "get" - }, - { - "associatedValues" : [ - - ], - "name" : "post" - }, - { - "associatedValues" : [ - - ], - "name" : "put" - }, - { - "associatedValues" : [ - - ], - "name" : "delete" - } - ], - "emitStyle" : "const", - "name" : "Method", - "namespace" : [ - "Networking", - "API" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Networking.API.Method", - "tsFullPath" : "Networking.API.Method" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Configuration", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Configuration", - "tsFullPath" : "Configuration" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "debug", - "rawValue" : "debug" - }, - { - "associatedValues" : [ - - ], - "name" : "info", - "rawValue" : "info" - }, - { - "associatedValues" : [ - - ], - "name" : "warning", - "rawValue" : "warning" - }, - { - "associatedValues" : [ - - ], - "name" : "error", - "rawValue" : "error" - } - ], - "emitStyle" : "const", - "name" : "LogLevel", - "namespace" : [ - "Configuration" - ], - "rawType" : "String", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Configuration.LogLevel", - "tsFullPath" : "Configuration.LogLevel" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "http", - "rawValue" : "80" - }, - { - "associatedValues" : [ - - ], - "name" : "https", - "rawValue" : "443" - }, - { - "associatedValues" : [ - - ], - "name" : "development", - "rawValue" : "3000" - } - ], - "emitStyle" : "const", - "name" : "Port", - "namespace" : [ - "Configuration" - ], - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Configuration.Port", - "tsFullPath" : "Configuration.Port" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Internal", - "namespace" : [ - "Networking", - "APIV2" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Internal", - "tsFullPath" : "Networking.APIV2.Internal" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "get" - }, - { - "associatedValues" : [ - - ], - "name" : "post" - } - ], - "emitStyle" : "const", - "name" : "SupportedMethod", - "namespace" : [ - "Networking", - "APIV2", - "Internal" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Internal.SupportedMethod", - "tsFullPath" : "Networking.APIV2.Internal.SupportedMethod" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - } - ], - "name" : "flag" - }, - { - "associatedValues" : [ - { - "type" : { - "float" : { - - } - } - } - ], - "name" : "rate" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - } - ], - "name" : "precise" - }, - { - "associatedValues" : [ - - ], - "name" : "info" - } - ], - "emitStyle" : "const", - "name" : "APIResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIResult", - "tsFullPath" : "APIResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "name" : "error" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "location" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "status" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - } - ], - "name" : "coordinates" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "comprehensive" - }, - { - "associatedValues" : [ - - ], - "name" : "info" - } - ], - "emitStyle" : "const", - "name" : "ComplexResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "ComplexResult", - "tsFullPath" : "ComplexResult" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Utilities", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utilities", - "tsFullPath" : "Utilities" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "Result", - "namespace" : [ - "Utilities" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utilities.Result", - "tsFullPath" : "Utilities.Result" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "API", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "API", - "tsFullPath" : "API" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "name" : "failure" - } - ], - "emitStyle" : "const", - "name" : "NetworkingResult", - "namespace" : [ - "API" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "API.NetworkingResult", - "tsFullPath" : "API.NetworkingResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - } - ], - "name" : "structPayload" - }, - { - "associatedValues" : [ - { - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "name" : "classPayload" - }, - { - "associatedValues" : [ - { - "type" : { - "jsObject" : { - - } - } - } - ], - "name" : "jsObjectPayload" - }, - { - "associatedValues" : [ - { - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "name" : "nestedEnum" - }, - { - "associatedValues" : [ - { - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "name" : "arrayPayload" - }, - { - "associatedValues" : [ - { - "type" : { - "jsObject" : { - "_0" : "Foo" - } - } - } - ], - "name" : "jsClassPayload" - }, - { - "associatedValues" : [ - - ], - "name" : "empty" - } - ], - "emitStyle" : "const", - "name" : "AllTypesResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "AllTypesResult", - "tsFullPath" : "AllTypesResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - } - ], - "name" : "precision" - }, - { - "associatedValues" : [ - { - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "name" : "direction" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optPrecision" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optDirection" - }, - { - "associatedValues" : [ - - ], - "name" : "empty" - } - ], - "emitStyle" : "const", - "name" : "TypedPayloadResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "TypedPayloadResult", - "tsFullPath" : "TypedPayloadResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "scientific" - }, - { - "associatedValues" : [ - - ], - "name" : "basic" - } - ], - "emitStyle" : "const", - "name" : "StaticCalculator", - "staticMethods" : [ - { - "abiName" : "bjs_StaticCalculator_static_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "enumName" : { - "_0" : "StaticCalculator" - } - } - }, - { - "abiName" : "bjs_StaticCalculator_static_doubleValue", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "doubleValue", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "enumName" : { - "_0" : "StaticCalculator" - } - } - } - ], - "staticProperties" : [ - { - "isReadonly" : true, - "isStatic" : true, - "name" : "version", - "staticContext" : { - "enumName" : { - "_0" : "StaticCalculator" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "StaticCalculator", - "tsFullPath" : "StaticCalculator" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "StaticUtils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "StaticUtils", - "tsFullPath" : "StaticUtils" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Nested", - "namespace" : [ - "StaticUtils" - ], - "staticMethods" : [ - { - "abiName" : "bjs_StaticUtils_Nested_static_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundtrip", - "namespace" : [ - "StaticUtils", - "Nested" - ], - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "StaticUtils.Nested" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "StaticUtils.Nested", - "tsFullPath" : "StaticUtils.Nested" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "GraphOperations", - "namespace" : [ - "Services", - "Graph" - ], - "staticMethods" : [ - { - "abiName" : "bjs_Services_Graph_GraphOperations_static_createGraph", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "createGraph", - "namespace" : [ - "Services", - "Graph", - "GraphOperations" - ], - "parameters" : [ - { - "label" : "rootId", - "name" : "rootId", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "GraphOperations" - } - } - }, - { - "abiName" : "bjs_Services_Graph_GraphOperations_static_nodeCount", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "nodeCount", - "namespace" : [ - "Services", - "Graph", - "GraphOperations" - ], - "parameters" : [ - { - "label" : "graphId", - "name" : "graphId", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "GraphOperations" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GraphOperations", - "tsFullPath" : "Services.Graph.GraphOperations" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "option1" - }, - { - "associatedValues" : [ - - ], - "name" : "option2" - } - ], - "emitStyle" : "const", - "name" : "StaticPropertyEnum", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumProperty", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "enumConstant", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumBool", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumVariable", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "computedReadonly", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "computedReadWrite", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "StaticPropertyEnum", - "tsFullPath" : "StaticPropertyEnum" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "StaticPropertyNamespace", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "namespaceProperty", - "namespace" : [ - "StaticPropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "StaticPropertyNamespace" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "namespaceConstant", - "namespace" : [ - "StaticPropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "StaticPropertyNamespace" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "StaticPropertyNamespace", - "tsFullPath" : "StaticPropertyNamespace" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "NestedProperties", - "namespace" : [ - "StaticPropertyNamespace" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedProperty", - "namespace" : [ - "StaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "StaticPropertyNamespace.NestedProperties" - } - }, - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "nestedConstant", - "namespace" : [ - "StaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "StaticPropertyNamespace.NestedProperties" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedDouble", - "namespace" : [ - "StaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - "_0" : "StaticPropertyNamespace.NestedProperties" - } - }, - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "StaticPropertyNamespace.NestedProperties", - "tsFullPath" : "StaticPropertyNamespace.NestedProperties" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "IntegerTypesSupportExports", - "staticMethods" : [ - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripInt", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - }, - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUInt", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "word" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - }, - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt8", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripInt8", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w8" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w8" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - }, - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt8", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUInt8", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w8" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w8" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - }, - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt16", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripInt16", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w16" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w16" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - }, - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt16", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUInt16", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w16" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w16" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - }, - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt32", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripInt32", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w32" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w32" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - }, - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt32", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUInt32", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w32" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w32" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - }, - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripInt64", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripInt64", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w64" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w64" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - }, - { - "abiName" : "bjs_IntegerTypesSupportExports_static_roundTripUInt64", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripUInt64", - "namespace" : [ - "IntegerTypesSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w64" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w64" - } - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "IntegerTypesSupportExports" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "IntegerTypesSupportExports", - "tsFullPath" : "IntegerTypesSupportExports" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "OptionalSupportExports", - "staticMethods" : [ - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalString", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalString", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalInt", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalInt", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalBool", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalBool", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalFloat", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalFloat", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "float" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "float" : { - - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalDouble", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalDouble", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalSyntax", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalCaseEnum", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalCaseEnum", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalStringRawValueEnum", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalStringRawValueEnum", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalIntRawValueEnum", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalIntRawValueEnum", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalInt64RawValueEnum", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalInt64RawValueEnum", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalUInt64RawValueEnum", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalUInt64RawValueEnum", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTSEnum", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalTSEnum", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTSStringEnum", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalTSStringEnum", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalNamespacedEnum", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalNamespacedEnum", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClass", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalSwiftClass", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalIntArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalIntArray", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalStringArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalStringArray", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalSwiftClassArray", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalSwiftClassArray", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalAPIResult", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalTypedPayloadResult", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalTypedPayloadResult", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalComplexResult", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalComplexResult", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalAllTypesResult", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalAllTypesResult", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResult", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalPayloadResult", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalPayloadResultOpt", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalPayloadResultOpt", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "OptionalAllTypesResult" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_roundTripOptionalAPIOptionalResult", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundTripOptionalAPIOptionalResult", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_takeOptionalJSObject", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "takeOptionalJSObject", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "void" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_applyOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "applyOptionalGreeter", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "_", - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_Sq7GreeterC", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_makeOptionalHolder", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "makeOptionalHolder", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "nullableGreeter", - "name" : "nullableGreeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "undefinedNumber", - "name" : "undefinedNumber", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "undefined" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "OptionalHolder" - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - }, - { - "abiName" : "bjs_OptionalSupportExports_static_compareAPIResults", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "compareAPIResults", - "namespace" : [ - "OptionalSupportExports" - ], - "parameters" : [ - { - "label" : "_", - "name" : "r1", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "_", - "name" : "r2", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - "_0" : "OptionalSupportExports" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "OptionalSupportExports", - "tsFullPath" : "OptionalSupportExports" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "Address" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optStruct" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optClass" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optJSObject" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optNestedEnum" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optArray" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "optJsClass" - }, - { - "associatedValues" : [ - - ], - "name" : "empty" - } - ], - "emitStyle" : "const", - "name" : "OptionalAllTypesResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "OptionalAllTypesResult", - "tsFullPath" : "OptionalAllTypesResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - }, - { - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "APIOptionalResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIOptionalResult", - "tsFullPath" : "APIOptionalResult" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_roundTripVoid", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_roundTripFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripFloat", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "float" : { - - } - } - } - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_roundTripDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDouble", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_roundTripBool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripBool", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_roundTripString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripString", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_roundTripSwiftHeapObject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripSwiftHeapObject", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_roundTripUnsafeRawPointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUnsafeRawPointer", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - }, - { - "abiName" : "bjs_roundTripUnsafeMutableRawPointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUnsafeMutableRawPointer", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - }, - { - "abiName" : "bjs_roundTripOpaquePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOpaquePointer", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - }, - { - "abiName" : "bjs_roundTripUnsafePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUnsafePointer", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } - } - } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } - } - } - }, - { - "abiName" : "bjs_roundTripUnsafeMutablePointer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUnsafeMutablePointer", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } - } - ], - "returnType" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } - }, - { - "abiName" : "bjs_roundTripJSObject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripJSObject", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_roundTripDictionaryExport", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDictionaryExport", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "dictionary" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "returnType" : { - "dictionary" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalDictionaryExport", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalDictionaryExport", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "dictionary" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "dictionary" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripJSValue", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "jsValue" : { - - } - } - } - ], - "returnType" : { - "jsValue" : { - - } - } - }, - { - "abiName" : "bjs_roundTripOptionalJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalJSValue", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "jsValue" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "jsValue" : { - - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalJSValueArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalJSValueArray", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_makeImportedFoo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "makeImportedFoo", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "jsObject" : { - "_0" : "Foo" - } - } - }, - { - "abiName" : "bjs_throwsSwiftError", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsSwiftError", - "parameters" : [ - { - "label" : "shouldThrow", - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithIntResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithIntResult", - "parameters" : [ - - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_throwsWithStringResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithStringResult", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithBoolResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithBoolResult", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithFloatResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithFloatResult", - "parameters" : [ - - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithDoubleResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithDoubleResult", - "parameters" : [ - - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithSwiftHeapObjectResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithSwiftHeapObjectResult", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_throwsWithJSObjectResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithJSObjectResult", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripVoid", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripInt", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripInt", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_asyncRoundTripFloat", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripFloat", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "float" : { - - } - } - } - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripDouble", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripDouble", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripBool", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripBool", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripString", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripString", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripSwiftHeapObject", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripSwiftHeapObject", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_asyncRoundTripJSObject", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripJSObject", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_takeGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeGreeter", - "parameters" : [ - { - "label" : "g", - "name" : "g", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_createCalculator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createCalculator", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Calculator" - } - } - }, - { - "abiName" : "bjs_useCalculator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "useCalculator", - "parameters" : [ - { - "label" : "calc", - "name" : "calc", - "type" : { - "swiftHeapObject" : { - "_0" : "Calculator" - } - } - }, - { - "label" : "x", - "name" : "x", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "y", - "name" : "y", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_testGreeterToJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testGreeterToJSValue", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_testCalculatorToJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testCalculatorToJSValue", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_testSwiftClassAsJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testSwiftClassAsJSValue", - "parameters" : [ - { - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_setDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setDirection", - "parameters" : [ - { - "label" : "_", - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Direction" - } - } - }, - { - "abiName" : "bjs_getDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getDirection", - "parameters" : [ - - ], - "returnType" : { - "caseEnum" : { - "_0" : "Direction" - } - } - }, - { - "abiName" : "bjs_processDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDirection", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "abiName" : "bjs_setTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_getTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTheme", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_setHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "status", - "type" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_getHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getHttpStatus", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_setFileSize", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setFileSize", - "parameters" : [ - { - "label" : "_", - "name" : "size", - "type" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - } - }, - { - "abiName" : "bjs_getFileSize", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getFileSize", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "FileSize", - "_1" : "Int64" - } - } - }, - { - "abiName" : "bjs_setSessionId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setSessionId", - "parameters" : [ - { - "label" : "_", - "name" : "session", - "type" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - }, - { - "abiName" : "bjs_getSessionId", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getSessionId", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "SessionId", - "_1" : "UInt64" - } - } - }, - { - "abiName" : "bjs_processTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_setTSDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTSDirection", - "parameters" : [ - { - "label" : "_", - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - }, - { - "abiName" : "bjs_getTSDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTSDirection", - "parameters" : [ - - ], - "returnType" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - }, - { - "abiName" : "bjs_setTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTSTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_getTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTSTheme", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_createConverter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createConverter", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" - } - } - }, - { - "abiName" : "bjs_useConverter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "useConverter", - "parameters" : [ - { - "label" : "converter", - "name" : "converter", - "type" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" - } - } - }, - { - "label" : "value", - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_roundTripConverterArray", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripConverterArray", - "parameters" : [ - { - "label" : "_", - "name" : "converters", - "type" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Utils.Converter" - } - } - } - } - }, - { - "abiName" : "bjs_createHTTPServer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createHTTPServer", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Networking.API.HTTPServer" - } - } - }, - { - "abiName" : "bjs_createUUID", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createUUID", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "UUID" - } - } - }, - { - "abiName" : "bjs_roundTripUUID", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripUUID", - "parameters" : [ - { - "label" : "_", - "name" : "uuid", - "type" : { - "swiftHeapObject" : { - "_0" : "UUID" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "UUID" - } - } - }, - { - "abiName" : "bjs_roundtripNetworkingAPIMethod", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripNetworkingAPIMethod", - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - }, - { - "abiName" : "bjs_roundtripConfigurationLogLevel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripConfigurationLogLevel", - "parameters" : [ - { - "label" : "_", - "name" : "level", - "type" : { - "rawValueEnum" : { - "_0" : "Configuration.LogLevel", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Configuration.LogLevel", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_roundtripConfigurationPort", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripConfigurationPort", - "parameters" : [ - { - "label" : "_", - "name" : "port", - "type" : { - "rawValueEnum" : { - "_0" : "Configuration.Port", - "_1" : "Int" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Configuration.Port", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_processConfigurationLogLevel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processConfigurationLogLevel", - "parameters" : [ - { - "label" : "_", - "name" : "level", - "type" : { - "rawValueEnum" : { - "_0" : "Configuration.LogLevel", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Configuration.Port", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_roundtripInternalSupportedMethod", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripInternalSupportedMethod", - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Internal.SupportedMethod" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Internal.SupportedMethod" - } - } - }, - { - "abiName" : "bjs_roundtripAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripAPIResult", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultSuccess", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultFailure", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultFailure", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultInfo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultInfo", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultFlag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultFlag", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultRate", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultRate", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "float" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultPrecise", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultPrecise", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_roundtripComplexResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripComplexResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultSuccess", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultError", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultError", - "parameters" : [ - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultLocation", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultLocation", - "parameters" : [ - { - "label" : "_", - "name" : "lat", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "lng", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultStatus", - "parameters" : [ - { - "label" : "_", - "name" : "active", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultCoordinates", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultCoordinates", - "parameters" : [ - { - "label" : "_", - "name" : "x", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "y", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "z", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultComprehensive", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultComprehensive", - "parameters" : [ - { - "label" : "_", - "name" : "flag1", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "flag2", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "count1", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "_", - "name" : "count2", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "_", - "name" : "value1", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "value2", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "text1", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "text2", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "text3", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultInfo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultInfo", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeUtilitiesResultSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeUtilitiesResultSuccess", - "parameters" : [ - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - }, - { - "abiName" : "bjs_makeUtilitiesResultFailure", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeUtilitiesResultFailure", - "parameters" : [ - { - "label" : "_", - "name" : "error", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - }, - { - "abiName" : "bjs_makeUtilitiesResultStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeUtilitiesResultStatus", - "parameters" : [ - { - "label" : "_", - "name" : "active", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - }, - { - "abiName" : "bjs_makeAPINetworkingResultSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPINetworkingResultSuccess", - "parameters" : [ - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" - } - } - }, - { - "abiName" : "bjs_makeAPINetworkingResultFailure", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPINetworkingResultFailure", - "parameters" : [ - { - "label" : "_", - "name" : "error", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" - } - } - }, - { - "abiName" : "bjs_roundtripUtilitiesResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripUtilitiesResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - }, - { - "abiName" : "bjs_roundtripAPINetworkingResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripAPINetworkingResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" - } - } - }, - { - "abiName" : "bjs_roundTripAllTypesResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripAllTypesResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "AllTypesResult" - } - } - }, - { - "abiName" : "bjs_roundTripTypedPayloadResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripTypedPayloadResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "TypedPayloadResult" - } - } - }, - { - "abiName" : "bjs_createPropertyHolder", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createPropertyHolder", - "parameters" : [ - { - "label" : "intValue", - "name" : "intValue", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "floatValue", - "name" : "floatValue", - "type" : { - "float" : { - - } - } - }, - { - "label" : "doubleValue", - "name" : "doubleValue", - "type" : { - "double" : { - - } - } - }, - { - "label" : "boolValue", - "name" : "boolValue", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "stringValue", - "name" : "stringValue", - "type" : { - "string" : { - - } - } - }, - { - "label" : "jsObject", - "name" : "jsObject", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "PropertyHolder" - } - } - }, - { - "abiName" : "bjs_testPropertyHolder", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testPropertyHolder", - "parameters" : [ - { - "label" : "holder", - "name" : "holder", - "type" : { - "swiftHeapObject" : { - "_0" : "PropertyHolder" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_resetObserverCounts", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetObserverCounts", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getObserverStats", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getObserverStats", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_formatName", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "formatName", - "parameters" : [ - { - "label" : "_", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "label" : "transform", - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_makeFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeFormatter", - "parameters" : [ - { - "label" : "prefix", - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_makeAdder", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAdder", - "parameters" : [ - { - "label" : "base", - "name" : "base", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "abiName" : "bjs_getSharedSubject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getSharedSubject", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "IdentityTestSubject" - } - } - }, - { - "abiName" : "bjs_resetSharedSubject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetSharedSubject", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getRetainLeakSubject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getRetainLeakSubject", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "RetainLeakSubject" - } - } - }, - { - "abiName" : "bjs_resetRetainLeakSubject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetRetainLeakSubject", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getRetainLeakDeinits", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getRetainLeakDeinits", - "parameters" : [ - - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_resetRetainLeakDeinits", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetRetainLeakDeinits", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_setupArrayPool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setupArrayPool", - "parameters" : [ - { - "label" : "_", - "name" : "count", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getArrayPool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getArrayPool", - "parameters" : [ - - ], - "returnType" : { - "array" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "ArrayIdentityElement" - } - } - } - } - }, - { - "abiName" : "bjs_getArrayPoolElement", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getArrayPoolElement", - "parameters" : [ - { - "label" : "_", - "name" : "index", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "ArrayIdentityElement" - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_getArrayPoolDeinits", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getArrayPoolDeinits", - "parameters" : [ - - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_resetArrayPoolDeinits", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetArrayPoolDeinits", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_clearArrayPool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "clearArrayPool", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_roundTripPointerFields", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripPointerFields", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "PointerFields" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "PointerFields" - } - } - }, - { - "abiName" : "bjs_testStructDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testStructDefault", - "parameters" : [ - { - "defaultValue" : { - "structLiteral" : { - "_0" : "DataPoint", - "_1" : [ - { - "name" : "x", - "value" : { - "float" : { - "_0" : 1 - } - } - }, - { - "name" : "y", - "value" : { - "float" : { - "_0" : 2 - } - } - }, - { - "name" : "label", - "value" : { - "string" : { - "_0" : "default" - } - } - }, - { - "name" : "optCount", - "value" : { - "null" : { - - } - } - }, - { - "name" : "optFlag", - "value" : { - "null" : { - - } - } - } - ] - } - }, - "label" : "point", - "name" : "point", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_cartToJSObject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "cartToJSObject", - "parameters" : [ - { - "label" : "_", - "name" : "cart", - "type" : { - "swiftStruct" : { - "_0" : "CopyableCart" - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_nestedCartToJSObject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "nestedCartToJSObject", - "parameters" : [ - { - "label" : "_", - "name" : "cart", - "type" : { - "swiftStruct" : { - "_0" : "CopyableNestedCart" - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_roundTripDataPoint", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDataPoint", - "parameters" : [ - { - "label" : "_", - "name" : "data", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - }, - { - "abiName" : "bjs_roundTripPublicPoint", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripPublicPoint", - "parameters" : [ - { - "label" : "_", - "name" : "point", - "type" : { - "swiftStruct" : { - "_0" : "PublicPoint" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "PublicPoint" - } - } - }, - { - "abiName" : "bjs_roundTripContact", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripContact", - "parameters" : [ - { - "label" : "_", - "name" : "contact", - "type" : { - "swiftStruct" : { - "_0" : "Contact" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Contact" - } - } - }, - { - "abiName" : "bjs_roundTripConfig", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripConfig", - "parameters" : [ - { - "label" : "_", - "name" : "config", - "type" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Config" - } - } - }, - { - "abiName" : "bjs_roundTripSessionData", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripSessionData", - "parameters" : [ - { - "label" : "_", - "name" : "session", - "type" : { - "swiftStruct" : { - "_0" : "SessionData" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "SessionData" - } - } - }, - { - "abiName" : "bjs_roundTripValidationReport", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripValidationReport", - "parameters" : [ - { - "label" : "_", - "name" : "report", - "type" : { - "swiftStruct" : { - "_0" : "ValidationReport" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "ValidationReport" - } - } - }, - { - "abiName" : "bjs_roundTripAdvancedConfig", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripAdvancedConfig", - "parameters" : [ - { - "label" : "_", - "name" : "config", - "type" : { - "swiftStruct" : { - "_0" : "AdvancedConfig" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "AdvancedConfig" - } - } - }, - { - "abiName" : "bjs_roundTripMeasurementConfig", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripMeasurementConfig", - "parameters" : [ - { - "label" : "_", - "name" : "config", - "type" : { - "swiftStruct" : { - "_0" : "MeasurementConfig" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "MeasurementConfig" - } - } - }, - { - "abiName" : "bjs_updateValidationReport", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "updateValidationReport", - "parameters" : [ - { - "label" : "_", - "name" : "newResult", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - }, - { - "label" : "_", - "name" : "report", - "type" : { - "swiftStruct" : { - "_0" : "ValidationReport" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "ValidationReport" - } - } - }, - { - "abiName" : "bjs_testContainerWithStruct", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testContainerWithStruct", - "parameters" : [ - { - "label" : "_", - "name" : "point", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Container" - } - } - }, - { - "abiName" : "bjs_roundTripJSObjectContainer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripJSObjectContainer", - "parameters" : [ - { - "label" : "_", - "name" : "container", - "type" : { - "swiftStruct" : { - "_0" : "JSObjectContainer" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "JSObjectContainer" - } - } - }, - { - "abiName" : "bjs_roundTripFooContainer", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripFooContainer", - "parameters" : [ - { - "label" : "_", - "name" : "container", - "type" : { - "swiftStruct" : { - "_0" : "FooContainer" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "FooContainer" - } - } - }, - { - "abiName" : "bjs_roundTripArrayMembers", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripArrayMembers", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "ArrayMembers" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "ArrayMembers" - } - } - }, - { - "abiName" : "bjs_arrayMembersSum", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "arrayMembersSum", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "ArrayMembers" - } - } - }, - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_arrayMembersFirst", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "arrayMembersFirst", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "ArrayMembers" - } - } - }, - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "protocols" : [ - { - "methods" : [ - - ], - "name" : "ArrayElementProtocol", - "properties" : [ - { - "isReadonly" : false, - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ] - }, - { - "methods" : [ - { - "abiName" : "bjs_DataProcessor_increment", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "increment", - "parameters" : [ - { - "label" : "by", - "name" : "amount", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_getValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getValue", - "parameters" : [ - - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_DataProcessor_setLabelElements", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setLabelElements", - "parameters" : [ - { - "label" : "_", - "name" : "labelPrefix", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "labelSuffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_getLabel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getLabel", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_isEven", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "isEven", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_processGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_createGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createGreeter", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_DataProcessor_processOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "greeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_createOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createOptionalGreeter", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "abiName" : "bjs_DataProcessor_handleAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "handleAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_getAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getAPIResult", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - } - ], - "name" : "DataProcessor", - "properties" : [ - { - "isReadonly" : false, - "name" : "count", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "name" : "optionalTag", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "name" : "optionalCount", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "name" : "direction", - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "name" : "optionalTheme", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "name" : "httpStatus", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "name" : "apiResult", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : false, - "name" : "helper", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "isReadonly" : false, - "name" : "optionalHelper", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ] - } - ], - "structs" : [ - { - "methods" : [ - - ], - "name" : "Point", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "x", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "y", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "Point" - }, - { - "constructor" : { - "abiName" : "bjs_PointerFields_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "raw", - "name" : "raw", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - }, - { - "label" : "mutRaw", - "name" : "mutRaw", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - }, - { - "label" : "opaque", - "name" : "opaque", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - }, - { - "label" : "ptr", - "name" : "ptr", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } - } - } - }, - { - "label" : "mutPtr", - "name" : "mutPtr", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "PointerFields", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "raw", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeRawPointer" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "mutRaw", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutableRawPointer" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "opaque", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "opaquePointer" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "ptr", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafePointer", - "pointee" : "UInt8" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "mutPtr", - "type" : { - "unsafePointer" : { - "_0" : { - "kind" : "unsafeMutablePointer", - "pointee" : "UInt8" - } - } - } - } - ], - "swiftCallName" : "PointerFields" - }, - { - "constructor" : { - "abiName" : "bjs_DataPoint_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "x", - "name" : "x", - "type" : { - "double" : { - - } - } - }, - { - "label" : "y", - "name" : "y", - "type" : { - "double" : { - - } - } - }, - { - "label" : "label", - "name" : "label", - "type" : { - "string" : { - - } - } - }, - { - "label" : "optCount", - "name" : "optCount", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "label" : "optFlag", - "name" : "optFlag", - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_DataPoint_static_origin", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "origin", - "parameters" : [ - - ], - "returnType" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - }, - "staticContext" : { - "structName" : { - "_0" : "DataPoint" - } - } - } - ], - "name" : "DataPoint", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "x", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "y", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "label", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optCount", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optFlag", - "type" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "dimensions", - "staticContext" : { - "structName" : { - "_0" : "DataPoint" - } - }, - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "DataPoint" - }, - { - "constructor" : { - "abiName" : "bjs_PublicPoint_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "x", - "name" : "x", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "label" : "y", - "name" : "y", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ] - }, - "explicitAccessControl" : "public", - "methods" : [ - - ], - "name" : "PublicPoint", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "x", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "y", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "PublicPoint" - }, - { - "methods" : [ - - ], - "name" : "Address", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "street", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "city", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "zipCode", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "Address" - }, - { - "methods" : [ - - ], - "name" : "Contact", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "age", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "address", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "email", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "secondaryAddress", - "type" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "Address" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "Contact" - }, - { - "methods" : [ - - ], - "name" : "Config", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "theme", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "direction", - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - ], - "swiftCallName" : "Config" - }, - { - "methods" : [ - - ], - "name" : "SessionData", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "owner", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "SessionData" - }, - { - "methods" : [ - - ], - "name" : "ValidationReport", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "status", - "type" : { - "nullable" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "outcome", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "ValidationReport" - }, - { - "methods" : [ - - ], - "name" : "AdvancedConfig", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "title", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "enabled", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "result", - "type" : { - "nullable" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "metadata", - "type" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "location", - "type" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "defaults", - "type" : { - "swiftStruct" : { - "_0" : "ConfigStruct" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "overrideDefaults", - "type" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "ConfigStruct" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "AdvancedConfig" - }, - { - "methods" : [ - - ], - "name" : "MeasurementConfig", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "precision", - "type" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "ratio", - "type" : { - "rawValueEnum" : { - "_0" : "Ratio", - "_1" : "Double" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optionalPrecision", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Precision", - "_1" : "Float" - } - }, - "_1" : "null" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optionalRatio", - "type" : { - "nullable" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Ratio", - "_1" : "Double" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "MeasurementConfig" - }, - { - "constructor" : { - "abiName" : "bjs_MathOperations_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "defaultValue" : { - "double" : { - "_0" : 0 - } - }, - "label" : "baseValue", - "name" : "baseValue", - "type" : { - "double" : { - - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_MathOperations_add", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "double" : { - - } - } - }, - { - "defaultValue" : { - "double" : { - "_0" : 10 - } - }, - "label" : "b", - "name" : "b", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_MathOperations_multiply", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "multiply", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "double" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_MathOperations_static_subtract", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "subtract", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "double" : { - - } - } - }, - { - "defaultValue" : { - "double" : { - "_0" : 5 - } - }, - "label" : "b", - "name" : "b", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - }, - "staticContext" : { - "structName" : { - "_0" : "MathOperations" - } - } - } - ], - "name" : "MathOperations", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "baseValue", - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "MathOperations" - }, - { - "methods" : [ - { - "abiName" : "bjs_CopyableCart_static_fromJSObject", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "fromJSObject", - "parameters" : [ - { - "label" : "_", - "name" : "object", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "CopyableCart" - } - }, - "staticContext" : { - "structName" : { - "_0" : "CopyableCart" - } - } - } - ], - "name" : "CopyableCart", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "x", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "note", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "CopyableCart" - }, - { - "methods" : [ - - ], - "name" : "CopyableCartItem", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "sku", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "quantity", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "swiftCallName" : "CopyableCartItem" - }, - { - "methods" : [ - { - "abiName" : "bjs_CopyableNestedCart_static_fromJSObject", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "fromJSObject", - "parameters" : [ - { - "label" : "_", - "name" : "object", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "CopyableNestedCart" - } - }, - "staticContext" : { - "structName" : { - "_0" : "CopyableNestedCart" - } - } - } - ], - "name" : "CopyableNestedCart", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "item", - "type" : { - "swiftStruct" : { - "_0" : "CopyableCartItem" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "shippingAddress", - "type" : { - "nullable" : { - "_0" : { - "swiftStruct" : { - "_0" : "Address" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "CopyableNestedCart" - }, - { - "methods" : [ - - ], - "name" : "ConfigStruct", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "defaultConfig", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "maxRetries", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "timeout", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "computedSetting", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "ConfigStruct" - }, - { - "constructor" : { - "abiName" : "bjs_Vector2D_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "dx", - "name" : "dx", - "type" : { - "double" : { - - } - } - }, - { - "label" : "dy", - "name" : "dy", - "type" : { - "double" : { - - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_Vector2D_magnitude", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "magnitude", - "parameters" : [ - - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_Vector2D_scaled", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "scaled", - "parameters" : [ - { - "label" : "by", - "name" : "factor", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Vector2D" - } - } - } - ], - "name" : "Vector2D", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "dx", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "dy", - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "Vector2D" - }, - { - "methods" : [ - - ], - "name" : "JSObjectContainer", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "object", - "type" : { - "jsObject" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optionalObject", - "type" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "JSObjectContainer" - }, - { - "methods" : [ - - ], - "name" : "FooContainer", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "foo", - "type" : { - "jsObject" : { - "_0" : "Foo" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optionalFoo", - "type" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "Foo" - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "FooContainer" - }, - { - "methods" : [ - { - "abiName" : "bjs_ArrayMembers_sumValues", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "sumValues", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "abiName" : "bjs_ArrayMembers_firstString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "firstString", - "parameters" : [ - { - "label" : "_", - "name" : "values", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "name" : "ArrayMembers", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "ints", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optStrings", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "swiftCallName" : "ArrayMembers" - } - ] - }, - "imported" : { - "children" : [ - { - "functions" : [ - - ], - "types" : [ - { - "constructor" : { - "parameters" : [ - { - "name" : "id", - "type" : { - "string" : { - - } - } - } - ] - }, - "getters" : [ - { - "name" : "id", - "type" : { - "string" : { - - } - } - } - ], - "methods" : [ - - ], - "name" : "ArrayElementObject", - "setters" : [ - - ], - "staticMethods" : [ - - ] - }, - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "ArraySupportImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsIntArrayLength", - "parameters" : [ - { - "name" : "items", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripIntArray", - "parameters" : [ - { - "name" : "items", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripNumberArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripStringArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripBoolArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripJSValueArray", - "parameters" : [ - { - "name" : "v", - "type" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripJSObjectArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "jsObject" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "jsObject" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripJSClassArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "jsObject" : { - "_0" : "ArrayElementObject" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "jsObject" : { - "_0" : "ArrayElementObject" - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalIntArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalStringArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalBoolArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "bool" : { - - } - }, - "_1" : "null" - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalJSValueArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsValue" : { - - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsValue" : { - - } - }, - "_1" : "null" - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalJSObjectArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - - } - }, - "_1" : "null" - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalJSClassArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "ArrayElementObject" - } - }, - "_1" : "null" - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "nullable" : { - "_0" : { - "jsObject" : { - "_0" : "ArrayElementObject" - } - }, - "_1" : "null" - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsSumNumberArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsCreateNumberArray", - "parameters" : [ - - ], - "returnType" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "runJsArraySupportTests", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ] - } - ] - }, - { - "functions" : [ - - ], - "types" : [ - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "AsyncImportImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripNumber", - "parameters" : [ - { - "name" : "v", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripBool", - "parameters" : [ - { - "name" : "v", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripString", - "parameters" : [ - { - "name" : "v", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripOptionalString", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripOptionalNumber", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "double" : { - - } - }, - "_1" : "null" - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripBoolArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripIntArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripStringArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsAsyncRoundTripFeatureFlag", - "parameters" : [ - { - "name" : "v", - "type" : { - "rawValueEnum" : { - "_0" : "FeatureFlag", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "FeatureFlag", - "_1" : "String" - } - } - } - ] - } - ] - }, - { - "functions" : [ - - ], - "types" : [ - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "ClosureSupportImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsApplyVoid", - "parameters" : [ - { - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsy_y", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsApplyBool", - "parameters" : [ - { - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsy_Sb", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsApplyInt", - "parameters" : [ - { - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsApplyDouble", - "parameters" : [ - { - "name" : "value", - "type" : { - "double" : { - - } - } - }, - { - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "double" : { - - } - } - ], - "returnType" : { - "double" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsApplyString", - "parameters" : [ - { - "name" : "value", - "type" : { - "string" : { - - } - } - }, - { - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsApplyJSObject", - "parameters" : [ - { - "name" : "value", - "type" : { - "jsObject" : { - - } - } - }, - { - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests8JSObjectC_8JSObjectC", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "jsObject" : { - - } - } - ], - "returnType" : { - "jsObject" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsMakeIntToInt", - "parameters" : [ - { - "name" : "base", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsMakeDoubleToDouble", - "parameters" : [ - { - "name" : "base", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSd_Sd", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "double" : { - - } - } - ], - "returnType" : { - "double" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsMakeStringToString", - "parameters" : [ - { - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : false - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsCallTwice", - "parameters" : [ - { - "name" : "value", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_y", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - ], - "returnType" : { - "void" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsCallBinary", - "parameters" : [ - { - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSiSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsCallTriple", - "parameters" : [ - { - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSiSiSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsCallAfterRelease", - "parameters" : [ - { - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsy_y", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsOptionalInvoke", - "parameters" : [ - { - "name" : "callback", - "type" : { - "nullable" : { - "_0" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsy_Sb", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsStoreClosure", - "parameters" : [ - { - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsy_y", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - }, - "sendingParameters" : false - }, - "useJSTypedClosure" : true - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsCallStoredClosure", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsHeapCount", - "parameters" : [ - - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "runJsClosureSupportTests", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ] - } - ] - }, - { - "functions" : [ - - ], - "types" : [ - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "DefaultArgumentImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "runJsDefaultArgumentTests", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ] - } - ] - }, - { - "functions" : [ - - ], - "types" : [ - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "DictionarySupportImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripDictionaryInt", - "parameters" : [ - { - "name" : "values", - "type" : { - "dictionary" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "returnType" : { - "dictionary" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripDictionaryBool", - "parameters" : [ - { - "name" : "values", - "type" : { - "dictionary" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "returnType" : { - "dictionary" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripDictionaryDouble", - "parameters" : [ - { - "name" : "values", - "type" : { - "dictionary" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "dictionary" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripDictionaryJSObject", - "parameters" : [ - { - "name" : "values", - "type" : { - "dictionary" : { - "_0" : { - "jsObject" : { - - } - } - } - } - } - ], - "returnType" : { - "dictionary" : { - "_0" : { - "jsObject" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripDictionaryJSValue", - "parameters" : [ - { - "name" : "values", - "type" : { - "dictionary" : { - "_0" : { - "jsValue" : { - - } - } - } - } - } - ], - "returnType" : { - "dictionary" : { - "_0" : { - "jsValue" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripDictionaryDoubleArray", - "parameters" : [ - { - "name" : "values", - "type" : { - "dictionary" : { - "_0" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - } - } - ], - "returnType" : { - "dictionary" : { - "_0" : { - "array" : { - "_0" : { - "double" : { - - } - } - } - } - } - } - } - ] - } - ] - }, - { - "functions" : [ - - ], - "types" : [ - { - "constructor" : { - "parameters" : [ - { - "name" : "value", - "type" : { - "string" : { - - } - } - } - ] - }, - "getters" : [ - { - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "methods" : [ - - ], - "name" : "Foo", - "setters" : [ - - ], - "staticMethods" : [ - - ] - } - ] - }, - { - "functions" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripNumber", - "parameters" : [ - { - "name" : "v", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripBool", - "parameters" : [ - { - "name" : "v", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripString", - "parameters" : [ - { - "name" : "v", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripJSValue", - "parameters" : [ - { - "name" : "v", - "type" : { - "jsValue" : { - - } - } - } - ], - "returnType" : { - "jsValue" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsThrowOrVoid", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsThrowOrNumber", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsThrowOrBool", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsThrowOrString", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripFeatureFlag", - "parameters" : [ - { - "name" : "flag", - "type" : { - "rawValueEnum" : { - "_0" : "FeatureFlag", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "FeatureFlag", - "_1" : "String" - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "runAsyncWorks", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : true - }, - "name" : "fetchWeatherData", - "parameters" : [ - { - "name" : "city", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "jsObject" : { - "_0" : "WeatherData" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "jsName" : "$jsWeirdFunction", - "name" : "_jsWeirdFunction", - "parameters" : [ - - ], - "returnType" : { - "double" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "from" : "global", - "name" : "parseInt", - "parameters" : [ - { - "name" : "string", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - } - ], - "globalGetters" : [ - { - "from" : "global", - "name" : "globalObject1", - "type" : { - "jsValue" : { - - } - } - } - ], - "types" : [ - { - "constructor" : { - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ] - }, - "getters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ], - "methods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "changeName", - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "JsGreeter", - "setters" : [ - { - "functionName" : "name_set", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "staticMethods" : [ - - ] - }, - { - "getters" : [ - { - "name" : "temperature", - "type" : { - "double" : { - - } - } - }, - { - "name" : "description", - "type" : { - "string" : { - - } - } - }, - { - "name" : "humidity", - "type" : { - "double" : { - - } - } - } - ], - "methods" : [ - - ], - "name" : "WeatherData", - "setters" : [ - { - "functionName" : "temperature_set", - "name" : "temperature", - "type" : { - "double" : { - - } - } - }, - { - "functionName" : "description_set", - "name" : "description", - "type" : { - "string" : { - - } - } - }, - { - "functionName" : "humidity_set", - "name" : "humidity", - "type" : { - "double" : { - - } - } - } - ], - "staticMethods" : [ - - ] - }, - { - "constructor" : { - "parameters" : [ - - ] - }, - "getters" : [ - - ], - "jsName" : "$WeirdClass", - "methods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "jsName" : "method-with-dashes", - "name" : "method_with_dashes", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "_WeirdClass", - "setters" : [ - - ], - "staticMethods" : [ - - ] - }, - { - "constructor" : { - "parameters" : [ - { - "name" : "value", - "type" : { - "double" : { - - } - } - } - ] - }, - "getters" : [ - - ], - "methods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "value", - "parameters" : [ - - ], - "returnType" : { - "double" : { - - } - } - } - ], - "name" : "StaticBox", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "create", - "parameters" : [ - { - "name" : "value", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "jsObject" : { - "_0" : "StaticBox" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "value", - "parameters" : [ - - ], - "returnType" : { - "double" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "makeDefault", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "StaticBox" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "jsName" : "with-dashes", - "name" : "with_dashes", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "StaticBox" - } - } - } - ] - }, - { - "constructor" : { - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "name" : "age", - "type" : { - "double" : { - - } - } - }, - { - "name" : "isCat", - "type" : { - "bool" : { - - } - } - } - ] - }, - "from" : "global", - "getters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "name" : "age", - "type" : { - "double" : { - - } - } - }, - { - "name" : "isCat", - "type" : { - "bool" : { - - } - } - } - ], - "methods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "bark", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "getIsCat", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - } - ], - "name" : "Animal", - "setters" : [ - { - "functionName" : "name_set", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "functionName" : "age_set", - "name" : "age", - "type" : { - "double" : { - - } - } - }, - { - "functionName" : "isCat_set", - "name" : "isCat", - "type" : { - "bool" : { - - } - } - } - ], - "staticMethods" : [ - - ] - } - ] - }, - { - "functions" : [ - - ], - "types" : [ - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "IdentityModeSupportImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "runJsIdentityModeSupportTests", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ] - } - ] - }, - { - "functions" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsTranslatePoint", - "parameters" : [ - { - "name" : "point", - "type" : { - "swiftStruct" : { - "_0" : "Point" - } - } - }, - { - "name" : "dx", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "name" : "dy", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Point" - } - } - } - ], - "types" : [ - - ] - }, - { - "functions" : [ - - ], - "types" : [ - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "IntegerTypesSupportImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripInt", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripUInt", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "word" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "word" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripInt8", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w8" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w8" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripUInt8", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w8" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w8" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripInt16", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w16" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w16" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripUInt16", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w16" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w16" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripInt32", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w32" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w32" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripUInt32", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w32" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w32" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripInt64", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w64" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "w64" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripUInt64", - "parameters" : [ - { - "name" : "v", - "type" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w64" - } - } - } - } - ], - "returnType" : { - "integer" : { - "_0" : { - "isSigned" : false, - "width" : "w64" - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "runJsIntegerTypesSupportTests", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ] - } - ] - }, - { - "functions" : [ - - ], - "types" : [ - { - "constructor" : { - "parameters" : [ - { - "name" : "numbers", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "name" : "labels", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ] - }, - "getters" : [ - { - "name" : "numbers", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "name" : "labels", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "methods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "concatNumbers", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "concatLabels", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "firstLabel", - "parameters" : [ - { - "name" : "values", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "JSClassWithArrayMembers", - "setters" : [ - { - "functionName" : "numbers_set", - "name" : "numbers", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "functionName" : "labels_set", - "name" : "labels", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "staticMethods" : [ - - ] - }, - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "JSClassSupportImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "makeJSClassWithArrayMembers", - "parameters" : [ - { - "name" : "numbers", - "type" : { - "array" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - } - } - } - }, - { - "name" : "labels", - "type" : { - "array" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "jsObject" : { - "_0" : "JSClassWithArrayMembers" - } - } - } - ] - } - ] - }, - { - "functions" : [ - - ], - "types" : [ - { - "constructor" : { - "parameters" : [ - - ] - }, - "from" : "global", - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "MyJSClassInternal", - "setters" : [ - - ], - "staticMethods" : [ - - ] - }, - { - "constructor" : { - "parameters" : [ - - ] - }, - "from" : "global", - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "MyJSClassPublic", - "setters" : [ - - ], - "staticMethods" : [ - - ] - }, - { - "constructor" : { - "parameters" : [ - - ] - }, - "from" : "global", - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "MyJSClassPackage", - "setters" : [ - - ], - "staticMethods" : [ - - ] - } - ] - }, - { - "functions" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsFunctionWithPackageAccess", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsFunctionWithPublicAccess", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsFunctionWithInternalAccess", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsFunctionWithFilePrivateAccess", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true + "_0" : "ArrayIdentityElement" + } }, - "name" : "jsFunctionWithPrivateAccess", - "parameters" : [ - - ], - "returnType" : { - "void" : { + "_1" : "null" + } + } + }, + { + "abiName" : "bjs_getArrayPoolDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getArrayPoolDeinits", + "parameters" : [ - } + ], + "returnType" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" } } - ], - "types" : [ - - ] + } }, { - "functions" : [ + "abiName" : "bjs_resetArrayPoolDeinits", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetArrayPoolDeinits", + "parameters" : [ ], - "types" : [ - { - "getters" : [ - - ], - "methods" : [ - - ], - "name" : "OptionalSupportImports", - "setters" : [ - - ], - "staticMethods" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalNumberNull", - "parameters" : [ - { - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "null" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalNumberUndefined", - "parameters" : [ - { - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "undefined" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "integer" : { - "_0" : { - "isSigned" : true, - "width" : "word" - } - } - }, - "_1" : "undefined" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalStringNull", - "parameters" : [ - { - "name" : "name", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "null" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalStringUndefined", - "parameters" : [ - { - "name" : "name", - "type" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "undefined" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "string" : { - - } - }, - "_1" : "undefined" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalJSValueArrayNull", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - }, - "_1" : "null" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalJSValueArrayUndefined", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - }, - "_1" : "undefined" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "array" : { - "_0" : { - "jsValue" : { - - } - } - } - }, - "_1" : "undefined" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalStringToStringDictionaryNull", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "dictionary" : { - "_0" : { - "string" : { - - } - } - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "dictionary" : { - "_0" : { - "string" : { + "returnType" : { + "void" : { - } - } - } - }, - "_1" : "null" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalStringToStringDictionaryUndefined", - "parameters" : [ - { - "name" : "v", - "type" : { - "nullable" : { - "_0" : { - "dictionary" : { - "_0" : { - "string" : { + } + } + }, + { + "abiName" : "bjs_clearArrayPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "clearArrayPool", + "parameters" : [ - } - } - } - }, - "_1" : "undefined" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "dictionary" : { - "_0" : { - "string" : { + ], + "returnType" : { + "void" : { - } - } - } - }, - "_1" : "undefined" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "runJsOptionalSupportTests", - "parameters" : [ + } + } + } + ], + "identityMode" : "pointer", + "protocols" : [ - ], - "returnType" : { - "void" : { + ], + "structs" : [ - } - } - } - ] - } - ] - }, + ] + }, + "imported" : { + "children" : [ { "functions" : [ - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "from" : "global", - "name" : "gc", - "parameters" : [ - - ], - "returnType" : { - "void" : { - } - } - } ], "types" : [ { @@ -20762,7 +416,7 @@ "methods" : [ ], - "name" : "SwiftClassSupportImports", + "name" : "IdentityModeTestImports", "setters" : [ ], @@ -20773,123 +427,9 @@ "isStatic" : false, "isThrows" : true }, - "name" : "jsRoundTripGreeter", - "parameters" : [ - { - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripUUID", - "parameters" : [ - { - "name" : "uuid", - "type" : { - "swiftHeapObject" : { - "_0" : "UUID" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "UUID" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsRoundTripOptionalGreeter", - "parameters" : [ - { - "name" : "greeter", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - } - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - }, - "_1" : "null" - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsConsumeLeakCheck", + "name" : "runJsIdentityModeTests", "parameters" : [ - { - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "LeakCheck" - } - } - } - ], - "returnType" : { - "void" : { - } - } - }, - { - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "jsConsumeOptionalLeakCheck", - "parameters" : [ - { - "name" : "value", - "type" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "LeakCheck" - } - }, - "_1" : "null" - } - } - } ], "returnType" : { "void" : { @@ -20903,5 +443,5 @@ } ] }, - "moduleName" : "BridgeJSRuntimeTests" + "moduleName" : "BridgeJSIdentityTests" } \ No newline at end of file diff --git a/Utilities/bridge-js-generate.sh b/Utilities/bridge-js-generate.sh index 22182d24b..77bdd0833 100755 --- a/Utilities/bridge-js-generate.sh +++ b/Utilities/bridge-js-generate.sh @@ -6,5 +6,6 @@ swift build --package-path ./Plugins/BridgeJS --product BridgeJSTool ./Plugins/BridgeJS/.build/debug/BridgeJSTool generate --project ./tsconfig.json --module-name BridgeJSRuntimeTests --target-dir ./Tests/BridgeJSRuntimeTests --output-dir ./Tests/BridgeJSRuntimeTests/Generated ./Plugins/BridgeJS/.build/debug/BridgeJSTool generate --project ./tsconfig.json --module-name BridgeJSGlobalTests --target-dir ./Tests/BridgeJSGlobalTests --output-dir ./Tests/BridgeJSGlobalTests/Generated +./Plugins/BridgeJS/.build/debug/BridgeJSTool generate --project ./tsconfig.json --module-name BridgeJSIdentityTests --target-dir ./Tests/BridgeJSIdentityTests --output-dir ./Tests/BridgeJSIdentityTests/Generated ./Plugins/BridgeJS/.build/debug/BridgeJSTool generate --project ./tsconfig.json --module-name Benchmarks --target-dir ./Benchmarks/Sources --output-dir ./Benchmarks/Sources/Generated ./Plugins/BridgeJS/.build/debug/BridgeJSTool generate --project ./tsconfig.json --module-name PlayBridgeJS --target-dir ./Examples/PlayBridgeJS/Sources/PlayBridgeJS --output-dir ./Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated From 7f61a8b3310f0cf3ba4dbd9bfc10296bdfe00873 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Fri, 17 Apr 2026 14:04:03 +0200 Subject: [PATCH 09/14] fix: Read identityMode from first skeleton that defines it When multiple targets share one createInstantiator (e.g. test package), use compactMap to find the first non-nil identityMode across all skeletons instead of reading from the first skeleton which may not have it set. --- Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 50d2a4317..2ee8cd869 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -983,7 +983,7 @@ public struct BridgeJSLink { try printer.indent { printer.write(lines: generateVariableDeclarations()) - let configIdentityMode = skeletons.compactMap(\.exported).first?.identityMode ?? "none" + let configIdentityMode = skeletons.compactMap(\.exported).compactMap(\.identityMode).first ?? "none" printer.write("const identityMode = options.identityMode ?? \"\(configIdentityMode)\";") printer.write( "const shouldUseIdentityMap = identityMode === \"pointer\" && typeof WeakRef !== \"undefined\" && typeof FinalizationRegistry !== \"undefined\";" From 40ed8d9f0f066d0cbf6756dc415a57819531d37b Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 21 Apr 2026 11:54:46 +0200 Subject: [PATCH 10/14] feat: Add identity mode benchmark infrastructure Extend run.js with --identity-mode, --identity-iterations, --identity-reuse-pools, and --identity-memory CLI flags. Extract identity scenarios into lib/identity-benchmarks.js: roundtrip reuse, bulk pool return (100 cached objects), churn (create-roundtrip-release), consume, and create paths. Memory telemetry via --identity-memory. Update README.md with identity mode flags and scenario descriptions. --- Benchmarks/README.md | 37 ++++ Benchmarks/lib/identity-benchmarks.js | 255 ++++++++++++++++++++++++++ Benchmarks/run.js | 45 ++++- 3 files changed, 330 insertions(+), 7 deletions(-) create mode 100644 Benchmarks/lib/identity-benchmarks.js diff --git a/Benchmarks/README.md b/Benchmarks/README.md index 65d867eba..409681eeb 100644 --- a/Benchmarks/README.md +++ b/Benchmarks/README.md @@ -35,3 +35,40 @@ node run.js --filter=Call node run.js --filter=/^Property access\// node run.js --filter=/string/i ``` + +## Identity Mode Benchmarks + +Compare `identityMode: "pointer"` vs default (`"none"`) for SwiftHeapObject wrapper caching. Requires `--expose-gc` for memory benchmarks. + +```bash +# Run identity benchmarks comparing both modes +node --expose-gc run.js --identity-mode=both + +# Pointer mode only +node --expose-gc run.js --identity-mode=pointer + +# Control iteration count (default: 1000000) +node --expose-gc run.js --identity-mode=both --identity-iterations=500000 + +# Control pool sizes for reuse scenarios (default: 1) +node --expose-gc run.js --identity-mode=both --identity-reuse-pools=1,16 + +# Include memory profiling (heap snapshots before/during/after) +node --expose-gc run.js --identity-mode=both --identity-memory + +# Combine with adaptive sampling +node --expose-gc run.js --identity-mode=both --adaptive + +# Save identity results +node --expose-gc run.js --identity-mode=both --output=results/identity-mode/results.json +``` + +### Identity Mode Scenarios + +| Scenario | What it measures | +|----------|-----------------| +| `passBothWaysRoundtrip` | Same object crossing boundary repeatedly (cache hit path) | +| `getPoolRepeated_100` | Bulk return of 100 cached objects (model collection pattern) | +| `churnObjects` | Create, roundtrip, release cycle (FinalizationRegistry cleanup pressure) | +| `swiftConsumesSameObject` | JS passes same object to Swift repeatedly | +| `swiftCreatesObject` | Fresh object creation overhead (cache miss path) | diff --git a/Benchmarks/lib/identity-benchmarks.js b/Benchmarks/lib/identity-benchmarks.js new file mode 100644 index 000000000..a916f694e --- /dev/null +++ b/Benchmarks/lib/identity-benchmarks.js @@ -0,0 +1,255 @@ +import { instantiate } from "../.build/plugins/PackageToJS/outputs/Package/instantiate.js" +import { defaultNodeSetup } from "../.build/plugins/PackageToJS/outputs/Package/platforms/node.js" + +/** + * Force a garbage collection cycle if available + */ +function forceGC() { + if (typeof globalThis.gc === 'function') { + globalThis.gc() + } +} + +/** + * Format a byte count as a human-readable string + * @param {number} bytes - Byte count to format + * @returns {string} Formatted string (B, KiB, or MiB) + */ +function formatBytes(bytes) { + if (Math.abs(bytes) < 1024) return `${bytes} B` + if (Math.abs(bytes) < 1024 * 1024) + return `${(bytes / 1024).toFixed(2)} KiB` + return `${(bytes / (1024 * 1024)).toFixed(2)} MiB` +} + +/** + * Parse the --identity-mode CLI argument into a list of modes to benchmark + * @param {string} modeArg - Mode argument: off, none, pointer, or both + * @returns {string[]} List of identity modes to run + */ +function parseIdentityModes(modeArg) { + if (!modeArg || modeArg === 'off') return [] + if (modeArg === 'none') return ['none'] + if (modeArg === 'pointer') return ['pointer'] + if (modeArg === 'both') return ['none', 'pointer'] + console.error( + `Invalid --identity-mode value: ${modeArg}. Expected off, none, pointer, or both.` + ) + process.exit(1) +} + +/** + * Parse the --identity-reuse-pools CLI argument into pool sizes + * @param {string} value - Comma-separated pool sizes (default: "1") + * @returns {number[]} List of pool sizes + */ +function parseIdentityReusePools(value) { + const raw = (value || '1') + .split(',') + .map((part) => part.trim()) + .filter(Boolean) + const parsed = [] + for (const item of raw) { + const poolSize = Number.parseInt(item, 10) + if (!Number.isInteger(poolSize) || poolSize <= 0) { + console.error( + `Invalid --identity-reuse-pools value: ${value}. Expected comma-separated positive integers.` + ) + process.exit(1) + } + if (!parsed.includes(poolSize)) { + parsed.push(poolSize) + } + } + if (parsed.length === 0) { + console.error( + 'Invalid --identity-reuse-pools value: expected at least one pool size.' + ) + process.exit(1) + } + return parsed +} + +/** + * Capture a memory profile sample for identity mode benchmarks. + * Measures heap cost of holding roundtrip results in an array. + * In pointer mode, retained entries reference the same wrapper; in none mode, each is distinct. + * @param {object} classRoundtrip - ClassRoundtrip instance + * @param {object} baseObject - Base SimpleClass instance + * @param {number} iterations - Number of roundtrip iterations + * @param {number} sampleInterval - How often to sample heap usage + * @returns {Promise} Memory profile sample + */ +async function captureIdentityMemorySample(classRoundtrip, baseObject, iterations, sampleInterval) { + const v8 = await import('v8') + forceGC() + const before = process.memoryUsage() + const beforeHeapStats = v8.getHeapStatistics() + let peakHeapUsed = before.heapUsed + + const retained = [] + let current = baseObject + const startedAt = performance.now() + for (let i = 0; i < iterations; i++) { + current = classRoundtrip.roundtripSimpleClass(current) + retained.push(current) + if ((i + 1) % sampleInterval === 0) { + peakHeapUsed = Math.max(peakHeapUsed, process.memoryUsage().heapUsed) + } + } + const durationMs = performance.now() - startedAt + + const afterRetain = process.memoryUsage() + peakHeapUsed = Math.max(peakHeapUsed, afterRetain.heapUsed) + retained.length = 0 + + forceGC() + const afterGC = process.memoryUsage() + const afterHeapStats = v8.getHeapStatistics() + + return { + iterations, + durationMs, + heapUsedBefore: before.heapUsed, + heapUsedPeak: peakHeapUsed, + heapUsedAfterRetain: afterRetain.heapUsed, + heapUsedAfterGC: afterGC.heapUsed, + heapSizeLimit: beforeHeapStats.heap_size_limit, + totalHeapSizeBefore: beforeHeapStats.total_heap_size, + totalHeapSizeAfter: afterHeapStats.total_heap_size, + retainedHeapDelta: afterRetain.heapUsed - before.heapUsed, + peakHeapDelta: peakHeapUsed - before.heapUsed, + postGCDelta: afterGC.heapUsed - before.heapUsed, + } +} + +/** + * Run identity mode benchmarks for each configured mode. + * Creates a separate WASM instance per mode to isolate identity cache state. + * @param {object} results - Results object to accumulate benchmark data + * @param {function|null} nameFilter - Optional filter for benchmark names + * @param {object|null} identityConfig - Identity benchmark configuration + * @param {function} benchmarkRunner - Benchmark runner function from singleRun + */ +async function runIdentityModeBenchmarks(results, nameFilter, identityConfig, benchmarkRunner) { + if (!identityConfig || identityConfig.modes.length === 0) return + + for (const mode of identityConfig.modes) { + const options = await defaultNodeSetup({}) + const { exports } = await instantiate({ + ...options, + identityMode: mode, + getImports: () => ({ + benchmarkHelperNoop: () => {}, + benchmarkHelperNoopWithNumber: () => {}, + benchmarkRunner: () => {}, + }), + }) + + const classRoundtrip = new exports.ClassRoundtrip() + const baseObject = new exports.SimpleClass('Hello', 42, true, 0.5, 3.14159) + + for (const poolSize of identityConfig.reusePools) { + const pool = Array.from({ length: poolSize }, (_, i) => { + return new exports.SimpleClass(`Hello ${i}`, i, true, 0.5, 3.14159) + }) + const testName = poolSize === 1 + ? `IdentityMode/${mode}/passBothWaysRoundtrip` + : `IdentityMode/${mode}/passBothWaysPool${poolSize}` + benchmarkRunner(testName, () => { + for (let i = 0; i < identityConfig.iterations; i++) { + const index = i % poolSize + pool[index] = classRoundtrip.roundtripSimpleClass(pool[index]) + } + }) + for (const object of pool) { + object.release() + } + } + + benchmarkRunner(`IdentityMode/${mode}/swiftConsumesSameObject`, () => { + for (let i = 0; i < identityConfig.iterations; i++) { + classRoundtrip.takeSimpleClass(baseObject) + } + }) + + + // Churn scenario: create, roundtrip, release in a tight loop. + // Tests FinalizationRegistry cleanup overhead when objects are + // constantly created and dropped. In pointer mode, the identity + // cache accumulates WeakRef entries that must be cleaned up. + benchmarkRunner(`IdentityMode/${mode}/churnObjects`, () => { + for (let i = 0; i < identityConfig.iterations; i++) { + const obj = new exports.SimpleClass(`temp ${i}`, i, true, 0.5, 3.14159) + classRoundtrip.roundtripSimpleClass(obj) + obj.release() + } + }) + + // Bulk array return: Swift returns same cached array of 100 objects. + // Tests the common pattern of returning model collections (e.g. building.floors). + // Uses fewer iterations since each call returns 100 objects. + const identityCacheBench = new exports.IdentityCacheBenchmark() + identityCacheBench.setupPool(100) + identityCacheBench.getPoolRepeated() // warm the cache + benchmarkRunner(`IdentityMode/${mode}/getPoolRepeated_100`, () => { + for (let i = 0; i < Math.floor(identityConfig.iterations / 100); i++) { + identityCacheBench.getPoolRepeated() + } + }) + identityCacheBench.release() + + benchmarkRunner(`IdentityMode/${mode}/swiftCreatesObject`, () => { + for (let i = 0; i < identityConfig.iterations; i++) { + classRoundtrip.makeSimpleClass() + } + }) + + if (identityConfig.memory) { + const sample = await captureIdentityMemorySample( + classRoundtrip, baseObject, + identityConfig.iterations, identityConfig.sampleInterval + ) + if (!identityConfig.memorySamples[mode]) { + identityConfig.memorySamples[mode] = [] + } + identityConfig.memorySamples[mode].push(sample) + } + + baseObject.release() + classRoundtrip.release() + } +} + +/** + * Summarize memory profiling results across all identity modes + * @param {object} identityConfig - Identity benchmark configuration with memorySamples + * @returns {object[]} Table rows for console.table display + */ +function summarizeIdentityMemory(identityConfig) { + const rows = [] + for (const mode of identityConfig.modes) { + const samples = identityConfig.memorySamples[mode] || [] + if (samples.length === 0) continue + const avg = (selector) => + samples.reduce((acc, sample) => acc + selector(sample), 0) / samples.length + rows.push({ + Mode: mode, + Samples: samples.length, + Iterations: samples[0].iterations, + 'Avg duration (ms)': avg((s) => s.durationMs).toFixed(2), + 'Avg peak delta': formatBytes(Math.round(avg((s) => s.peakHeapDelta))), + 'Avg retained delta': formatBytes(Math.round(avg((s) => s.retainedHeapDelta))), + 'Avg post-GC delta': formatBytes(Math.round(avg((s) => s.postGCDelta))), + 'Heap limit': formatBytes(samples[0].heapSizeLimit), + }) + } + return rows +} + +export { + parseIdentityModes, + parseIdentityReusePools, + runIdentityModeBenchmarks, + summarizeIdentityMemory, +} diff --git a/Benchmarks/run.js b/Benchmarks/run.js index 5a1ae61e6..772c84f2b 100644 --- a/Benchmarks/run.js +++ b/Benchmarks/run.js @@ -2,7 +2,8 @@ import { instantiate } from "./.build/plugins/PackageToJS/outputs/Package/instan import { defaultNodeSetup } from "./.build/plugins/PackageToJS/outputs/Package/platforms/node.js" import fs from 'fs'; import path from 'path'; -import { parseArgs } from "util"; +import { parseArgs } from "util" +import { parseIdentityModes, parseIdentityReusePools, runIdentityModeBenchmarks, summarizeIdentityMemory } from "./lib/identity-benchmarks.js" import { APIResultValues as APIResult, ComplexResultValues as ComplexResult } from "./.build/plugins/PackageToJS/outputs/Package/bridge-js.js"; /** @@ -275,7 +276,7 @@ function saveJsonResults(filePath, data) { * @param {number} iterations - Loop iterations per JS benchmark * @returns {Promise} */ -async function singleRun(results, nameFilter, iterations) { +async function singleRun(results, nameFilter, iterations, identityConfig) { const options = await defaultNodeSetup({}) const benchmarkRunner = (name, body) => { if (nameFilter && !nameFilter(name)) { @@ -869,6 +870,8 @@ async function singleRun(results, nameFilter, iterations) { arrayRoundtrip.roundtripOptionalArray(null) } }) + + await runIdentityModeBenchmarks(results, nameFilter, identityConfig, benchmarkRunner) } /** @@ -878,7 +881,7 @@ async function singleRun(results, nameFilter, iterations) { * @param {number} iterations - Loop iterations per JS benchmark * @returns {Promise} */ -async function runUntilStable(results, options, width, nameFilter, filterArg, iterations) { +async function runUntilStable(results, options, width, nameFilter, filterArg, iterations, identityConfig) { const { minRuns = 5, maxRuns = 50, @@ -897,7 +900,7 @@ async function runUntilStable(results, options, width, nameFilter, filterArg, it // Update progress with estimated completion updateProgress(runs, maxRuns, "Benchmark Progress:", width); - await singleRun(results, nameFilter, iterations); + await singleRun(results, nameFilter, iterations, identityConfig) runs++; if (runs === 1 && Object.keys(results).length === 0) { @@ -968,6 +971,10 @@ Options: --max-runs=NUMBER Maximum runs for adaptive sampling (default: 50) --target-cv=NUMBER Target coefficient of variation % (default: 5) --filter=PATTERN Filter benchmarks by name (substring or /regex/flags) + --identity-mode=MODE Identity benchmarks: off, none, pointer, both (default: off) + --identity-iterations=N Iterations for identity benchmarks (default: 1000000) + --identity-reuse-pools=N,N Pool sizes for reuse scenarios (default: 1) + --identity-memory Enable memory profiling for identity benchmarks --help Show this help message `); } @@ -984,7 +991,11 @@ async function main() { 'min-runs': { type: 'string', default: '5' }, 'max-runs': { type: 'string', default: '50' }, 'target-cv': { type: 'string', default: '5' }, - filter: { type: 'string' } + filter: { type: 'string' }, + 'identity-mode': { type: 'string', default: 'off' }, + 'identity-iterations': { type: 'string', default: '1000000' }, + 'identity-reuse-pools': { type: 'string' }, + 'identity-memory': { type: 'boolean', default: false } } }); @@ -998,6 +1009,17 @@ async function main() { const filterArg = args.values.filter; const nameFilter = createNameFilter(filterArg); + const identityModes = parseIdentityModes(args.values['identity-mode']) + const identityIterations = parseInt(args.values['identity-iterations'], 10) + const identityConfig = identityModes.length > 0 ? { + modes: identityModes, + iterations: identityIterations, + reusePools: parseIdentityReusePools(args.values['identity-reuse-pools']), + memory: args.values['identity-memory'], + memorySamples: {}, + sampleInterval: 10000, + } : null + const iterations = parseInt(args.values.iterations, 10); if (isNaN(iterations) || iterations <= 0) { console.error('Invalid --iterations value:', args.values.iterations); @@ -1017,7 +1039,7 @@ async function main() { console.log(`Results will be saved to: ${args.values.output}`); } - await runUntilStable(results, options, width, nameFilter, filterArg, iterations); + await runUntilStable(results, options, width, nameFilter, filterArg, iterations, identityConfig) } else { // Fixed number of runs mode const runs = parseInt(args.values.runs, 10); @@ -1039,7 +1061,7 @@ async function main() { console.log("\nOverall Progress:"); for (let i = 0; i < runs; i++) { updateProgress(i, runs, "Benchmark Runs:", width); - await singleRun(results, nameFilter, iterations); + await singleRun(results, nameFilter, iterations, identityConfig) if (i === 0 && Object.keys(results).length === 0) { process.stdout.write("\n"); console.error(`No benchmarks matched filter: ${filterArg}`); @@ -1071,6 +1093,15 @@ async function main() { } } + // Identity memory summary + if (identityConfig?.memory) { + const memoryRows = summarizeIdentityMemory(identityConfig) + if (memoryRows.length > 0) { + console.log("\n=== Identity Mode Memory Profile ===") + console.table(memoryRows) + } + } + // Save JSON to file if specified if (args.values.output) { saveJsonResults(args.values.output, formattedResults); From 19c3f8e4ee58420f4faa5ebc9d64b982e30b5da1 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 21 Apr 2026 11:54:53 +0200 Subject: [PATCH 11/14] feat: Add identity mode benchmark Swift sources Add IdentityCacheBenchmark with setupPool/getPoolRepeated for bulk array return scenarios. Update generated BridgeJS bindings for benchmark target. --- Benchmarks/Sources/Benchmarks.swift | 48 ++++ Benchmarks/Sources/Generated/BridgeJS.swift | 169 ++++++++++++ .../Generated/JavaScript/BridgeJS.json | 243 ++++++++++++++++++ 3 files changed, 460 insertions(+) diff --git a/Benchmarks/Sources/Benchmarks.swift b/Benchmarks/Sources/Benchmarks.swift index 59da8c96c..45a2438ea 100644 --- a/Benchmarks/Sources/Benchmarks.swift +++ b/Benchmarks/Sources/Benchmarks.swift @@ -257,6 +257,54 @@ enum ComplexResult { } } +// MARK: - Class Array Performance Tests + +nonisolated(unsafe) var _classArrayPool: [SimpleClass] = [] + +@JS class ClassArrayRoundtrip { + @JS init() {} + + @JS func setupPool(_ count: Int) { + _classArrayPool = (0.. [SimpleClass] { + return _classArrayPool + } + + @JS func makeClassArray() -> [SimpleClass] { + return (0..<100).map { + SimpleClass(name: "Item \($0)", count: $0, flag: true, rate: 0.5, precise: 3.14) + } + } + + @JS func takeClassArray(_ values: [SimpleClass]) {} + + @JS func roundtripClassArray(_ values: [SimpleClass]) -> [SimpleClass] { + return values + } +} + +// MARK: - Identity Cache Benchmark + +nonisolated(unsafe) var _cachedPool: [SimpleClass] = [] + +@JS class IdentityCacheBenchmark { + @JS init() {} + + @JS func setupPool(_ count: Int) { + _cachedPool = (0.. [SimpleClass] { + return _cachedPool + } +} + // MARK: - Array Performance Tests @JS struct Point { diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index c9adb2b1a..f01d84fb8 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1373,6 +1373,175 @@ fileprivate func _bjs_ClassRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPoin return _bjs_ClassRoundtrip_wrap_extern(pointer) } +@_expose(wasm, "bjs_ClassArrayRoundtrip_init") +@_cdecl("bjs_ClassArrayRoundtrip_init") +public func _bjs_ClassArrayRoundtrip_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassArrayRoundtrip() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassArrayRoundtrip_setupPool") +@_cdecl("bjs_ClassArrayRoundtrip_setupPool") +public func _bjs_ClassArrayRoundtrip_setupPool(_ _self: UnsafeMutableRawPointer, _ count: Int32) -> Void { + #if arch(wasm32) + ClassArrayRoundtrip.bridgeJSLiftParameter(_self).setupPool(_: Int.bridgeJSLiftParameter(count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassArrayRoundtrip_getPool") +@_cdecl("bjs_ClassArrayRoundtrip_getPool") +public func _bjs_ClassArrayRoundtrip_getPool(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ClassArrayRoundtrip.bridgeJSLiftParameter(_self).getPool() + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassArrayRoundtrip_makeClassArray") +@_cdecl("bjs_ClassArrayRoundtrip_makeClassArray") +public func _bjs_ClassArrayRoundtrip_makeClassArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ClassArrayRoundtrip.bridgeJSLiftParameter(_self).makeClassArray() + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassArrayRoundtrip_takeClassArray") +@_cdecl("bjs_ClassArrayRoundtrip_takeClassArray") +public func _bjs_ClassArrayRoundtrip_takeClassArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ClassArrayRoundtrip.bridgeJSLiftParameter(_self).takeClassArray(_: [SimpleClass].bridgeJSStackPop()) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassArrayRoundtrip_roundtripClassArray") +@_cdecl("bjs_ClassArrayRoundtrip_roundtripClassArray") +public func _bjs_ClassArrayRoundtrip_roundtripClassArray(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = ClassArrayRoundtrip.bridgeJSLiftParameter(_self).roundtripClassArray(_: [SimpleClass].bridgeJSStackPop()) + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassArrayRoundtrip_deinit") +@_cdecl("bjs_ClassArrayRoundtrip_deinit") +public func _bjs_ClassArrayRoundtrip_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension ClassArrayRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ClassArrayRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_ClassArrayRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_ClassArrayRoundtrip_wrap") +fileprivate func _bjs_ClassArrayRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ClassArrayRoundtrip_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_ClassArrayRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ClassArrayRoundtrip_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_IdentityCacheBenchmark_init") +@_cdecl("bjs_IdentityCacheBenchmark_init") +public func _bjs_IdentityCacheBenchmark_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = IdentityCacheBenchmark() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityCacheBenchmark_setupPool") +@_cdecl("bjs_IdentityCacheBenchmark_setupPool") +public func _bjs_IdentityCacheBenchmark_setupPool(_ _self: UnsafeMutableRawPointer, _ count: Int32) -> Void { + #if arch(wasm32) + IdentityCacheBenchmark.bridgeJSLiftParameter(_self).setupPool(_: Int.bridgeJSLiftParameter(count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityCacheBenchmark_getPoolRepeated") +@_cdecl("bjs_IdentityCacheBenchmark_getPoolRepeated") +public func _bjs_IdentityCacheBenchmark_getPoolRepeated(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = IdentityCacheBenchmark.bridgeJSLiftParameter(_self).getPoolRepeated() + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityCacheBenchmark_getSingleRepeated") +@_cdecl("bjs_IdentityCacheBenchmark_getSingleRepeated") +public func _bjs_IdentityCacheBenchmark_getSingleRepeated(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = IdentityCacheBenchmark.bridgeJSLiftParameter(_self).getSingleRepeated() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityCacheBenchmark_deinit") +@_cdecl("bjs_IdentityCacheBenchmark_deinit") +public func _bjs_IdentityCacheBenchmark_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension IdentityCacheBenchmark: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_IdentityCacheBenchmark_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_IdentityCacheBenchmark_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_IdentityCacheBenchmark_wrap") +fileprivate func _bjs_IdentityCacheBenchmark_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_IdentityCacheBenchmark_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_IdentityCacheBenchmark_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_IdentityCacheBenchmark_wrap_extern(pointer) +} + @_expose(wasm, "bjs_ArrayRoundtrip_init") @_cdecl("bjs_ArrayRoundtrip_init") public func _bjs_ArrayRoundtrip_init() -> UnsafeMutableRawPointer { diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json index b2c33ac01..15da088ec 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -1270,6 +1270,249 @@ ], "swiftCallName" : "ClassRoundtrip" }, + { + "constructor" : { + "abiName" : "bjs_ClassArrayRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_ClassArrayRoundtrip_setupPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setupPool", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ClassArrayRoundtrip_getPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getPool", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + } + }, + { + "abiName" : "bjs_ClassArrayRoundtrip_makeClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeClassArray", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + } + }, + { + "abiName" : "bjs_ClassArrayRoundtrip_takeClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeClassArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ClassArrayRoundtrip_roundtripClassArray", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripClassArray", + "parameters" : [ + { + "label" : "_", + "name" : "values", + "type" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + } + } + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + } + } + ], + "name" : "ClassArrayRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "ClassArrayRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_IdentityCacheBenchmark_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_IdentityCacheBenchmark_setupPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setupPool", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_IdentityCacheBenchmark_getPoolRepeated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getPoolRepeated", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + } + }, + { + "abiName" : "bjs_IdentityCacheBenchmark_getSingleRepeated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getSingleRepeated", + "parameters" : [ + + ], + "returnType" : { + "nullable" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + }, + "_1" : "null" + } + } + } + ], + "name" : "IdentityCacheBenchmark", + "properties" : [ + + ], + "swiftCallName" : "IdentityCacheBenchmark" + }, { "constructor" : { "abiName" : "bjs_ArrayRoundtrip_init", From 2aac6d62d12b480588f0fec6106997470286a023 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 21 Apr 2026 11:55:19 +0200 Subject: [PATCH 12/14] perf: Add IQR outlier removal and median to benchmark statistics Benchmark results can be noisy due to GC timing and V8 JIT compilation. IQR filtering discards values outside Q1-1.5*IQR to Q3+1.5*IQR before computing statistics. The Samples column shows retained count (e.g. '4 (-1)' means 4 kept, 1 discarded). Falls back to the full dataset if fewer than 4 samples. Applies to all benchmarks, not just identity mode. --- Benchmarks/Sources/Generated/BridgeJS.swift | 11 --- .../Generated/JavaScript/BridgeJS.json | 22 ----- Benchmarks/run.js | 82 +++++++++++++------ 3 files changed, 57 insertions(+), 58 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index f01d84fb8..66cab321e 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1500,17 +1500,6 @@ public func _bjs_IdentityCacheBenchmark_getPoolRepeated(_ _self: UnsafeMutableRa #endif } -@_expose(wasm, "bjs_IdentityCacheBenchmark_getSingleRepeated") -@_cdecl("bjs_IdentityCacheBenchmark_getSingleRepeated") -public func _bjs_IdentityCacheBenchmark_getSingleRepeated(_ _self: UnsafeMutableRawPointer) -> Void { - #if arch(wasm32) - let ret = IdentityCacheBenchmark.bridgeJSLiftParameter(_self).getSingleRepeated() - return ret.bridgeJSLowerReturn() - #else - fatalError("Only available on WebAssembly") - #endif -} - @_expose(wasm, "bjs_IdentityCacheBenchmark_deinit") @_cdecl("bjs_IdentityCacheBenchmark_deinit") public func _bjs_IdentityCacheBenchmark_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json index 15da088ec..9036b503e 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -1483,28 +1483,6 @@ } } } - }, - { - "abiName" : "bjs_IdentityCacheBenchmark_getSingleRepeated", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getSingleRepeated", - "parameters" : [ - - ], - "returnType" : { - "nullable" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "SimpleClass" - } - }, - "_1" : "null" - } - } } ], "name" : "IdentityCacheBenchmark", diff --git a/Benchmarks/run.js b/Benchmarks/run.js index 772c84f2b..f72ee6a47 100644 --- a/Benchmarks/run.js +++ b/Benchmarks/run.js @@ -2,7 +2,7 @@ import { instantiate } from "./.build/plugins/PackageToJS/outputs/Package/instan import { defaultNodeSetup } from "./.build/plugins/PackageToJS/outputs/Package/platforms/node.js" import fs from 'fs'; import path from 'path'; -import { parseArgs } from "util" +import { parseArgs } from "util"; import { parseIdentityModes, parseIdentityReusePools, runIdentityModeBenchmarks, summarizeIdentityMemory } from "./lib/identity-benchmarks.js" import { APIResultValues as APIResult, ComplexResultValues as ComplexResult } from "./.build/plugins/PackageToJS/outputs/Package/bridge-js.js"; @@ -63,17 +63,44 @@ function createNameFilter(arg) { * @returns {number} Coefficient of variation as a percentage */ function calculateCV(values) { - if (values.length < 2) return 0; - - const sum = values.reduce((a, b) => a + b, 0); - const mean = sum / values.length; - - if (mean === 0) return 0; + if (values.length < 2) return 0 + const filtered = removeOutliers(values) + const sum = filtered.reduce((a, b) => a + b, 0) + const mean = sum / filtered.length + if (mean === 0) return 0 + const variance = filtered.reduce((a, b) => a + Math.pow(b - mean, 2), 0) / filtered.length + const stdDev = Math.sqrt(variance) + return (stdDev / mean) * 100 +} - const variance = values.reduce((a, b) => a + Math.pow(b - mean, 2), 0) / values.length; - const stdDev = Math.sqrt(variance); +/** + * Remove outliers using the IQR (interquartile range) method. + * Discards values below Q1-1.5*IQR or above Q3+1.5*IQR. + * Returns the filtered array (or the original if too few samples). + * @param {Array} values - Array of measurement values + * @returns {Array} Values with outliers removed + */ +function removeOutliers(values) { + if (values.length < 4) return values + const sorted = [...values].sort((a, b) => a - b) + const q1 = sorted[Math.floor(sorted.length * 0.25)] + const q3 = sorted[Math.floor(sorted.length * 0.75)] + const iqr = q3 - q1 + const lower = q1 - 1.5 * iqr + const upper = q3 + 1.5 * iqr + const filtered = values.filter(v => v >= lower && v <= upper) + return filtered.length > 0 ? filtered : values +} - return (stdDev / mean) * 100; // Return as percentage +/** + * Calculate the median of an array of numbers + * @param {Array} values - Array of measurement values + * @returns {number} Median value + */ +function median(values) { + const sorted = [...values].sort((a, b) => a - b) + const mid = Math.floor(sorted.length / 2) + return sorted.length % 2 !== 0 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2 } /** @@ -86,33 +113,38 @@ function calculateStatistics(results) { const consoleTable = []; for (const [name, times] of Object.entries(results)) { - const sum = times.reduce((a, b) => a + b, 0); - const avg = sum / times.length; - const min = Math.min(...times); - const max = Math.max(...times); - const variance = times.reduce((a, b) => a + Math.pow(b - avg, 2), 0) / times.length; - const stdDev = Math.sqrt(variance); - const cv = (stdDev / avg) * 100; // Coefficient of variation as percentage + const filtered = removeOutliers(times) + const sum = filtered.reduce((a, b) => a + b, 0) + const avg = sum / filtered.length + const med = median(filtered) + const min = Math.min(...filtered) + const max = Math.max(...filtered) + const variance = filtered.reduce((a, b) => a + Math.pow(b - avg, 2), 0) / filtered.length + const stdDev = Math.sqrt(variance) + const cv = (stdDev / avg) * 100 + const outliers = times.length - filtered.length formattedResults[name] = { "avg_ms": parseFloat(avg.toFixed(2)), + "median_ms": parseFloat(med.toFixed(2)), "min_ms": parseFloat(min.toFixed(2)), "max_ms": parseFloat(max.toFixed(2)), "stdDev_ms": parseFloat(stdDev.toFixed(2)), "cv_percent": parseFloat(cv.toFixed(2)), - "samples": times.length, + "samples": filtered.length, + "outliers_removed": outliers, "rawTimes_ms": times.map(t => parseFloat(t.toFixed(2))) - }; + } consoleTable.push({ Test: name, + 'Median (ms)': med.toFixed(2), 'Avg (ms)': avg.toFixed(2), 'Min (ms)': min.toFixed(2), 'Max (ms)': max.toFixed(2), - 'StdDev (ms)': stdDev.toFixed(2), 'CV (%)': cv.toFixed(2), - 'Samples': times.length - }); + 'Samples': filtered.length + (outliers > 0 ? ` (-${outliers})` : '') + }) } return { formattedResults, consoleTable }; @@ -283,7 +315,7 @@ async function singleRun(results, nameFilter, iterations, identityConfig) { return; } // Warmup to reduce JIT/IC noise. - body(); + body() if (typeof globalThis.gc === "function") { globalThis.gc(); } @@ -900,7 +932,7 @@ async function runUntilStable(results, options, width, nameFilter, filterArg, it // Update progress with estimated completion updateProgress(runs, maxRuns, "Benchmark Progress:", width); - await singleRun(results, nameFilter, iterations, identityConfig) + await singleRun(results, nameFilter, iterations, identityConfig); runs++; if (runs === 1 && Object.keys(results).length === 0) { @@ -973,7 +1005,7 @@ Options: --filter=PATTERN Filter benchmarks by name (substring or /regex/flags) --identity-mode=MODE Identity benchmarks: off, none, pointer, both (default: off) --identity-iterations=N Iterations for identity benchmarks (default: 1000000) - --identity-reuse-pools=N,N Pool sizes for reuse scenarios (default: 1) + --identity-reuse-pools=N,N Pool sizes for reuse scenarios (default: 1,8,64) --identity-memory Enable memory profiling for identity benchmarks --help Show this help message `); From b47bd9c137bb70f982f845359157628177a8d8a2 Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Tue, 21 Apr 2026 15:00:11 +0200 Subject: [PATCH 13/14] feat: Add per-class identityMode via @JS macro parameter Add identityMode: Bool parameter to @JS macro. When set to true on a class, that class uses pointer identity caching. When false or not set, the class uses the bridge-js.config.json default. Identity is resolved entirely at codegen time - no runtime option. Classes with identity mode get static __identityCache passed to __wrap. Classes without it pass null. No runtime branching in __construct. Resolution: @JS(identityMode: true/false) > bridge-js.config.json > default (off). --- Benchmarks/README.md | 34 +- Benchmarks/Sources/Benchmarks.swift | 55 +++ Benchmarks/Sources/Generated/BridgeJS.swift | 284 ++++++++++++++ .../Generated/JavaScript/BridgeJS.json | 279 ++++++++++++++ Benchmarks/Sources/bridge-js.config.json | 1 - Benchmarks/lib/identity-benchmarks.js | 86 +++-- Benchmarks/run.js | 4 +- .../BridgeJSCore/SwiftToSkeleton.swift | 12 +- .../Sources/BridgeJSLink/BridgeJSLink.swift | 68 +++- .../BridgeJSSkeleton/BridgeJSSkeleton.swift | 5 +- .../BridgeJSToolTests/BridgeJSLinkTests.swift | 74 ++-- .../Inputs/MacroSwift/IdentityModeClass.swift | 28 ++ .../IdentityModeClass.json | 148 +++++++ .../IdentityModeClass.swift | 188 +++++++++ .../BridgeJSLinkTests/ArrayTypes.d.ts | 1 - .../BridgeJSLinkTests/ArrayTypes.js | 12 +- .../BridgeJSLinkTests/Async.d.ts | 1 - .../__Snapshots__/BridgeJSLinkTests/Async.js | 2 - .../BridgeJSLinkTests/AsyncImport.d.ts | 1 - .../BridgeJSLinkTests/AsyncImport.js | 2 - .../BridgeJSLinkTests/AsyncStaticImport.d.ts | 1 - .../BridgeJSLinkTests/AsyncStaticImport.js | 2 - .../BridgeJSLinkTests/DefaultParameters.d.ts | 1 - .../BridgeJSLinkTests/DefaultParameters.js | 16 +- .../BridgeJSLinkTests/DictionaryTypes.d.ts | 1 - .../BridgeJSLinkTests/DictionaryTypes.js | 8 +- .../EnumAssociatedValue.d.ts | 1 - .../BridgeJSLinkTests/EnumAssociatedValue.js | 8 +- .../BridgeJSLinkTests/EnumCase.d.ts | 1 - .../BridgeJSLinkTests/EnumCase.js | 2 - .../EnumNamespace.Global.d.ts | 1 - .../BridgeJSLinkTests/EnumNamespace.Global.js | 20 +- .../BridgeJSLinkTests/EnumNamespace.d.ts | 1 - .../BridgeJSLinkTests/EnumNamespace.js | 20 +- .../BridgeJSLinkTests/EnumRawType.d.ts | 1 - .../BridgeJSLinkTests/EnumRawType.js | 2 - .../BridgeJSLinkTests/FixedWidthIntegers.d.ts | 1 - .../BridgeJSLinkTests/FixedWidthIntegers.js | 2 - .../BridgeJSLinkTests/GlobalGetter.d.ts | 1 - .../BridgeJSLinkTests/GlobalGetter.js | 2 - .../BridgeJSLinkTests/GlobalThisImports.d.ts | 1 - .../BridgeJSLinkTests/GlobalThisImports.js | 2 - .../IdentityModeClass.ConfigPointer.d.ts | 42 ++ .../IdentityModeClass.ConfigPointer.js | 362 ++++++++++++++++++ .../IdentityModeClass.PerClass.d.ts | 42 ++ .../IdentityModeClass.PerClass.js | 350 +++++++++++++++++ .../BridgeJSLinkTests/IdentityModeClass.d.ts | 42 ++ .../BridgeJSLinkTests/IdentityModeClass.js | 350 +++++++++++++++++ .../BridgeJSLinkTests/ImportArray.d.ts | 1 - .../BridgeJSLinkTests/ImportArray.js | 2 - .../ImportedTypeInExportedInterface.d.ts | 1 - .../ImportedTypeInExportedInterface.js | 2 - .../InvalidPropertyNames.d.ts | 1 - .../BridgeJSLinkTests/InvalidPropertyNames.js | 2 - .../BridgeJSLinkTests/JSClass.d.ts | 1 - .../BridgeJSLinkTests/JSClass.js | 2 - .../JSClassStaticFunctions.d.ts | 1 - .../JSClassStaticFunctions.js | 2 - .../BridgeJSLinkTests/JSValue.d.ts | 1 - .../BridgeJSLinkTests/JSValue.js | 8 +- .../BridgeJSLinkTests/MixedGlobal.d.ts | 1 - .../BridgeJSLinkTests/MixedGlobal.js | 8 +- .../BridgeJSLinkTests/MixedModules.d.ts | 1 - .../BridgeJSLinkTests/MixedModules.js | 12 +- .../BridgeJSLinkTests/MixedPrivate.d.ts | 1 - .../BridgeJSLinkTests/MixedPrivate.js | 8 +- .../BridgeJSLinkTests/Namespaces.Global.d.ts | 1 - .../BridgeJSLinkTests/Namespaces.Global.js | 20 +- .../BridgeJSLinkTests/Namespaces.d.ts | 1 - .../BridgeJSLinkTests/Namespaces.js | 20 +- .../BridgeJSLinkTests/Optionals.d.ts | 1 - .../BridgeJSLinkTests/Optionals.js | 12 +- .../PrimitiveParameters.d.ts | 1 - .../BridgeJSLinkTests/PrimitiveParameters.js | 2 - .../BridgeJSLinkTests/PrimitiveReturn.d.ts | 1 - .../BridgeJSLinkTests/PrimitiveReturn.js | 2 - .../BridgeJSLinkTests/PropertyTypes.d.ts | 1 - .../BridgeJSLinkTests/PropertyTypes.js | 8 +- .../BridgeJSLinkTests/Protocol.d.ts | 1 - .../BridgeJSLinkTests/Protocol.js | 16 +- .../BridgeJSLinkTests/ProtocolInClosure.d.ts | 1 - .../BridgeJSLinkTests/ProtocolInClosure.js | 8 +- .../StaticFunctions.Global.d.ts | 1 - .../StaticFunctions.Global.js | 8 +- .../BridgeJSLinkTests/StaticFunctions.d.ts | 1 - .../BridgeJSLinkTests/StaticFunctions.js | 8 +- .../StaticProperties.Global.d.ts | 1 - .../StaticProperties.Global.js | 8 +- .../BridgeJSLinkTests/StaticProperties.d.ts | 1 - .../BridgeJSLinkTests/StaticProperties.js | 8 +- .../BridgeJSLinkTests/StringParameter.d.ts | 1 - .../BridgeJSLinkTests/StringParameter.js | 2 - .../BridgeJSLinkTests/StringReturn.d.ts | 1 - .../BridgeJSLinkTests/StringReturn.js | 2 - .../BridgeJSLinkTests/SwiftClass.d.ts | 1 - .../BridgeJSLinkTests/SwiftClass.js | 16 +- .../BridgeJSLinkTests/SwiftClosure.d.ts | 1 - .../BridgeJSLinkTests/SwiftClosure.js | 12 +- .../SwiftClosureImports.d.ts | 1 - .../BridgeJSLinkTests/SwiftClosureImports.js | 2 - .../BridgeJSLinkTests/SwiftStruct.d.ts | 1 - .../BridgeJSLinkTests/SwiftStruct.js | 8 +- .../BridgeJSLinkTests/SwiftStructImports.d.ts | 1 - .../BridgeJSLinkTests/SwiftStructImports.js | 2 - .../BridgeJSLinkTests/Throws.d.ts | 1 - .../__Snapshots__/BridgeJSLinkTests/Throws.js | 2 - .../BridgeJSLinkTests/UnsafePointer.d.ts | 1 - .../BridgeJSLinkTests/UnsafePointer.js | 2 - .../VoidParameterVoidReturn.d.ts | 1 - .../VoidParameterVoidReturn.js | 2 - Plugins/PackageToJS/Templates/index.d.ts | 6 - Plugins/PackageToJS/Templates/index.js | 9 +- .../PackageToJS/Templates/instantiate.d.ts | 5 - Sources/JavaScriptKit/Macros.swift | 3 +- .../JSClosure+AsyncTests.swift | 89 +++-- 115 files changed, 2472 insertions(+), 455 deletions(-) delete mode 100644 Benchmarks/Sources/bridge-js.config.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/IdentityModeClass.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.json create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.swift create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.js create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.d.ts create mode 100644 Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.js diff --git a/Benchmarks/README.md b/Benchmarks/README.md index 409681eeb..834ddcdbf 100644 --- a/Benchmarks/README.md +++ b/Benchmarks/README.md @@ -38,15 +38,35 @@ node run.js --filter=/string/i ## Identity Mode Benchmarks -Compare `identityMode: "pointer"` vs default (`"none"`) for SwiftHeapObject wrapper caching. Requires `--expose-gc` for memory benchmarks. +Compare `identityMode: "pointer"` vs default (`"none"`) for SwiftHeapObject wrapper caching. Both class variants are compiled into the **same build** via per-class `@JS(identityMode: true)` annotations, so no separate builds or config files are needed. + +Requires `--expose-gc` for memory benchmarks. + +### Build once + +```bash +swift package --swift-sdk $SWIFT_SDK_ID js -c release +``` + +### Compare both modes in one run ```bash -# Run identity benchmarks comparing both modes -node --expose-gc run.js --identity-mode=both +node --expose-gc run.js --identity-mode=both --identity-iterations=1000000 +``` + +### Run only one mode -# Pointer mode only -node --expose-gc run.js --identity-mode=pointer +```bash +# Only pointer (identity-cached) classes +node --expose-gc run.js --identity-mode=pointer --identity-iterations=1000000 +# Only non-identity classes +node --expose-gc run.js --identity-mode=none --identity-iterations=1000000 +``` + +### Additional options + +```bash # Control iteration count (default: 1000000) node --expose-gc run.js --identity-mode=both --identity-iterations=500000 @@ -59,8 +79,8 @@ node --expose-gc run.js --identity-mode=both --identity-memory # Combine with adaptive sampling node --expose-gc run.js --identity-mode=both --adaptive -# Save identity results -node --expose-gc run.js --identity-mode=both --output=results/identity-mode/results.json +# Filter to specific identity benchmarks +node --expose-gc run.js --adaptive --filter=passBothWaysRoundtrip --identity-mode=both --identity-iterations=1000000 ``` ### Identity Mode Scenarios diff --git a/Benchmarks/Sources/Benchmarks.swift b/Benchmarks/Sources/Benchmarks.swift index 45a2438ea..3e24e597b 100644 --- a/Benchmarks/Sources/Benchmarks.swift +++ b/Benchmarks/Sources/Benchmarks.swift @@ -305,6 +305,61 @@ nonisolated(unsafe) var _cachedPool: [SimpleClass] = [] } } +// MARK: - Identity Mode Benchmark Variants +// These classes use @JS(identityMode: true) so that identity cache benchmarks +// can run in the SAME build alongside the non-identity classes above. + +@JS(identityMode: true) +class SimpleClassIdentity { + @JS var name: String + @JS var count: Int + @JS var flag: Bool + @JS var rate: Float + @JS var precise: Double + + @JS init(name: String, count: Int, flag: Bool, rate: Float, precise: Double) { + self.name = name + self.count = count + self.flag = flag + self.rate = rate + self.precise = precise + } +} + +@JS(identityMode: true) +class ClassRoundtripIdentity { + @JS init() {} + + @JS func roundtripSimpleClassIdentity(_ obj: SimpleClassIdentity) -> SimpleClassIdentity { + return obj + } + + @JS func makeSimpleClassIdentity() -> SimpleClassIdentity { + return SimpleClassIdentity(name: "Hello", count: 42, flag: true, rate: 0.5, precise: 3.14159) + } + + @JS func takeSimpleClassIdentity(_ obj: SimpleClassIdentity) { + // consume without returning + } +} + +nonisolated(unsafe) var _cachedPoolIdentity: [SimpleClassIdentity] = [] + +@JS(identityMode: true) +class IdentityCacheBenchmarkIdentity { + @JS init() {} + + @JS func setupPool(_ count: Int) { + _cachedPoolIdentity = (0.. [SimpleClassIdentity] { + return _cachedPoolIdentity + } +} + // MARK: - Array Performance Tests @JS struct Point { diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index 66cab321e..e199e4a29 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1531,6 +1531,290 @@ fileprivate func _bjs_IdentityCacheBenchmark_wrap_extern(_ pointer: UnsafeMutabl return _bjs_IdentityCacheBenchmark_wrap_extern(pointer) } +@_expose(wasm, "bjs_SimpleClassIdentity_init") +@_cdecl("bjs_SimpleClassIdentity_init") +public func _bjs_SimpleClassIdentity_init(_ nameBytes: Int32, _ nameLength: Int32, _ count: Int32, _ flag: Int32, _ rate: Float32, _ precise: Float64) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = SimpleClassIdentity(name: String.bridgeJSLiftParameter(nameBytes, nameLength), count: Int.bridgeJSLiftParameter(count), flag: Bool.bridgeJSLiftParameter(flag), rate: Float.bridgeJSLiftParameter(rate), precise: Double.bridgeJSLiftParameter(precise)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_name_get") +@_cdecl("bjs_SimpleClassIdentity_name_get") +public func _bjs_SimpleClassIdentity_name_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = SimpleClassIdentity.bridgeJSLiftParameter(_self).name + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_name_set") +@_cdecl("bjs_SimpleClassIdentity_name_set") +public func _bjs_SimpleClassIdentity_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + SimpleClassIdentity.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_count_get") +@_cdecl("bjs_SimpleClassIdentity_count_get") +public func _bjs_SimpleClassIdentity_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SimpleClassIdentity.bridgeJSLiftParameter(_self).count + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_count_set") +@_cdecl("bjs_SimpleClassIdentity_count_set") +public func _bjs_SimpleClassIdentity_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + SimpleClassIdentity.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_flag_get") +@_cdecl("bjs_SimpleClassIdentity_flag_get") +public func _bjs_SimpleClassIdentity_flag_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = SimpleClassIdentity.bridgeJSLiftParameter(_self).flag + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_flag_set") +@_cdecl("bjs_SimpleClassIdentity_flag_set") +public func _bjs_SimpleClassIdentity_flag_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + SimpleClassIdentity.bridgeJSLiftParameter(_self).flag = Bool.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_rate_get") +@_cdecl("bjs_SimpleClassIdentity_rate_get") +public func _bjs_SimpleClassIdentity_rate_get(_ _self: UnsafeMutableRawPointer) -> Float32 { + #if arch(wasm32) + let ret = SimpleClassIdentity.bridgeJSLiftParameter(_self).rate + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_rate_set") +@_cdecl("bjs_SimpleClassIdentity_rate_set") +public func _bjs_SimpleClassIdentity_rate_set(_ _self: UnsafeMutableRawPointer, _ value: Float32) -> Void { + #if arch(wasm32) + SimpleClassIdentity.bridgeJSLiftParameter(_self).rate = Float.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_precise_get") +@_cdecl("bjs_SimpleClassIdentity_precise_get") +public func _bjs_SimpleClassIdentity_precise_get(_ _self: UnsafeMutableRawPointer) -> Float64 { + #if arch(wasm32) + let ret = SimpleClassIdentity.bridgeJSLiftParameter(_self).precise + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_precise_set") +@_cdecl("bjs_SimpleClassIdentity_precise_set") +public func _bjs_SimpleClassIdentity_precise_set(_ _self: UnsafeMutableRawPointer, _ value: Float64) -> Void { + #if arch(wasm32) + SimpleClassIdentity.bridgeJSLiftParameter(_self).precise = Double.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_SimpleClassIdentity_deinit") +@_cdecl("bjs_SimpleClassIdentity_deinit") +public func _bjs_SimpleClassIdentity_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension SimpleClassIdentity: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_SimpleClassIdentity_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_SimpleClassIdentity_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_SimpleClassIdentity_wrap") +fileprivate func _bjs_SimpleClassIdentity_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_SimpleClassIdentity_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_SimpleClassIdentity_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_SimpleClassIdentity_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_ClassRoundtripIdentity_init") +@_cdecl("bjs_ClassRoundtripIdentity_init") +public func _bjs_ClassRoundtripIdentity_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassRoundtripIdentity() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtripIdentity_roundtripSimpleClassIdentity") +@_cdecl("bjs_ClassRoundtripIdentity_roundtripSimpleClassIdentity") +public func _bjs_ClassRoundtripIdentity_roundtripSimpleClassIdentity(_ _self: UnsafeMutableRawPointer, _ obj: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassRoundtripIdentity.bridgeJSLiftParameter(_self).roundtripSimpleClassIdentity(_: SimpleClassIdentity.bridgeJSLiftParameter(obj)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtripIdentity_makeSimpleClassIdentity") +@_cdecl("bjs_ClassRoundtripIdentity_makeSimpleClassIdentity") +public func _bjs_ClassRoundtripIdentity_makeSimpleClassIdentity(_ _self: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ClassRoundtripIdentity.bridgeJSLiftParameter(_self).makeSimpleClassIdentity() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtripIdentity_takeSimpleClassIdentity") +@_cdecl("bjs_ClassRoundtripIdentity_takeSimpleClassIdentity") +public func _bjs_ClassRoundtripIdentity_takeSimpleClassIdentity(_ _self: UnsafeMutableRawPointer, _ obj: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + ClassRoundtripIdentity.bridgeJSLiftParameter(_self).takeSimpleClassIdentity(_: SimpleClassIdentity.bridgeJSLiftParameter(obj)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ClassRoundtripIdentity_deinit") +@_cdecl("bjs_ClassRoundtripIdentity_deinit") +public func _bjs_ClassRoundtripIdentity_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension ClassRoundtripIdentity: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ClassRoundtripIdentity_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_ClassRoundtripIdentity_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_ClassRoundtripIdentity_wrap") +fileprivate func _bjs_ClassRoundtripIdentity_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ClassRoundtripIdentity_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_ClassRoundtripIdentity_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ClassRoundtripIdentity_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_IdentityCacheBenchmarkIdentity_init") +@_cdecl("bjs_IdentityCacheBenchmarkIdentity_init") +public func _bjs_IdentityCacheBenchmarkIdentity_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = IdentityCacheBenchmarkIdentity() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityCacheBenchmarkIdentity_setupPool") +@_cdecl("bjs_IdentityCacheBenchmarkIdentity_setupPool") +public func _bjs_IdentityCacheBenchmarkIdentity_setupPool(_ _self: UnsafeMutableRawPointer, _ count: Int32) -> Void { + #if arch(wasm32) + IdentityCacheBenchmarkIdentity.bridgeJSLiftParameter(_self).setupPool(_: Int.bridgeJSLiftParameter(count)) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityCacheBenchmarkIdentity_getPoolRepeated") +@_cdecl("bjs_IdentityCacheBenchmarkIdentity_getPoolRepeated") +public func _bjs_IdentityCacheBenchmarkIdentity_getPoolRepeated(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = IdentityCacheBenchmarkIdentity.bridgeJSLiftParameter(_self).getPoolRepeated() + ret.bridgeJSStackPush() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_IdentityCacheBenchmarkIdentity_deinit") +@_cdecl("bjs_IdentityCacheBenchmarkIdentity_deinit") +public func _bjs_IdentityCacheBenchmarkIdentity_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension IdentityCacheBenchmarkIdentity: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_IdentityCacheBenchmarkIdentity_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_IdentityCacheBenchmarkIdentity_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_IdentityCacheBenchmarkIdentity_wrap") +fileprivate func _bjs_IdentityCacheBenchmarkIdentity_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_IdentityCacheBenchmarkIdentity_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_IdentityCacheBenchmarkIdentity_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_IdentityCacheBenchmarkIdentity_wrap_extern(pointer) +} + @_expose(wasm, "bjs_ArrayRoundtrip_init") @_cdecl("bjs_ArrayRoundtrip_init") public func _bjs_ArrayRoundtrip_init() -> UnsafeMutableRawPointer { diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json index 9036b503e..0bddddfb6 100644 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -1491,6 +1491,285 @@ ], "swiftCallName" : "IdentityCacheBenchmark" }, + { + "constructor" : { + "abiName" : "bjs_SimpleClassIdentity_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "label" : "count", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "label" : "flag", + "name" : "flag", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "rate", + "name" : "rate", + "type" : { + "float" : { + + } + } + }, + { + "label" : "precise", + "name" : "precise", + "type" : { + "double" : { + + } + } + } + ] + }, + "identityMode" : true, + "methods" : [ + + ], + "name" : "SimpleClassIdentity", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "flag", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "rate", + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "precise", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "SimpleClassIdentity" + }, + { + "constructor" : { + "abiName" : "bjs_ClassRoundtripIdentity_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "identityMode" : true, + "methods" : [ + { + "abiName" : "bjs_ClassRoundtripIdentity_roundtripSimpleClassIdentity", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripSimpleClassIdentity", + "parameters" : [ + { + "label" : "_", + "name" : "obj", + "type" : { + "swiftHeapObject" : { + "_0" : "SimpleClassIdentity" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "SimpleClassIdentity" + } + } + }, + { + "abiName" : "bjs_ClassRoundtripIdentity_makeSimpleClassIdentity", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSimpleClassIdentity", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "SimpleClassIdentity" + } + } + }, + { + "abiName" : "bjs_ClassRoundtripIdentity_takeSimpleClassIdentity", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeSimpleClassIdentity", + "parameters" : [ + { + "label" : "_", + "name" : "obj", + "type" : { + "swiftHeapObject" : { + "_0" : "SimpleClassIdentity" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "ClassRoundtripIdentity", + "properties" : [ + + ], + "swiftCallName" : "ClassRoundtripIdentity" + }, + { + "constructor" : { + "abiName" : "bjs_IdentityCacheBenchmarkIdentity_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "identityMode" : true, + "methods" : [ + { + "abiName" : "bjs_IdentityCacheBenchmarkIdentity_setupPool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setupPool", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_IdentityCacheBenchmarkIdentity_getPoolRepeated", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getPoolRepeated", + "parameters" : [ + + ], + "returnType" : { + "array" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "SimpleClassIdentity" + } + } + } + } + } + ], + "name" : "IdentityCacheBenchmarkIdentity", + "properties" : [ + + ], + "swiftCallName" : "IdentityCacheBenchmarkIdentity" + }, { "constructor" : { "abiName" : "bjs_ArrayRoundtrip_init", diff --git a/Benchmarks/Sources/bridge-js.config.json b/Benchmarks/Sources/bridge-js.config.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/Benchmarks/Sources/bridge-js.config.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/Benchmarks/lib/identity-benchmarks.js b/Benchmarks/lib/identity-benchmarks.js index a916f694e..f83eb9c1d 100644 --- a/Benchmarks/lib/identity-benchmarks.js +++ b/Benchmarks/lib/identity-benchmarks.js @@ -1,6 +1,3 @@ -import { instantiate } from "../.build/plugins/PackageToJS/outputs/Package/instantiate.js" -import { defaultNodeSetup } from "../.build/plugins/PackageToJS/outputs/Package/platforms/node.js" - /** * Force a garbage collection cycle if available */ @@ -23,9 +20,14 @@ function formatBytes(bytes) { } /** - * Parse the --identity-mode CLI argument into a list of modes to benchmark + * Parse the --identity-mode CLI argument into mode labels. + * + * Both class variants (with and without identity mode) are compiled into the + * same WASM build via per-class `@JS(identityMode: true)` annotations, so + * "both" mode works in a single run. + * * @param {string} modeArg - Mode argument: off, none, pointer, or both - * @returns {string[]} List of identity modes to run + * @returns {string[]} Array of mode labels, or empty for "off" */ function parseIdentityModes(modeArg) { if (!modeArg || modeArg === 'off') return [] @@ -73,14 +75,13 @@ function parseIdentityReusePools(value) { /** * Capture a memory profile sample for identity mode benchmarks. * Measures heap cost of holding roundtrip results in an array. - * In pointer mode, retained entries reference the same wrapper; in none mode, each is distinct. - * @param {object} classRoundtrip - ClassRoundtrip instance - * @param {object} baseObject - Base SimpleClass instance + * @param {function} roundtrip - Function that roundtrips an object + * @param {object} baseObject - Base object instance * @param {number} iterations - Number of roundtrip iterations * @param {number} sampleInterval - How often to sample heap usage * @returns {Promise} Memory profile sample */ -async function captureIdentityMemorySample(classRoundtrip, baseObject, iterations, sampleInterval) { +async function captureIdentityMemorySample(roundtrip, baseObject, iterations, sampleInterval) { const v8 = await import('v8') forceGC() const before = process.memoryUsage() @@ -91,7 +92,7 @@ async function captureIdentityMemorySample(classRoundtrip, baseObject, iteration let current = baseObject const startedAt = performance.now() for (let i = 0; i < iterations; i++) { - current = classRoundtrip.roundtripSimpleClass(current) + current = roundtrip(current) retained.push(current) if ((i + 1) % sampleInterval === 0) { peakHeapUsed = Math.max(peakHeapUsed, process.memoryUsage().heapUsed) @@ -124,34 +125,47 @@ async function captureIdentityMemorySample(classRoundtrip, baseObject, iteration } /** - * Run identity mode benchmarks for each configured mode. - * Creates a separate WASM instance per mode to isolate identity cache state. + * Run identity mode benchmarks using dual-class strategy. + * + * Both class variants live in the same WASM build: + * - "none" mode uses: SimpleClass, ClassRoundtrip, IdentityCacheBenchmark + * - "pointer" mode uses: SimpleClassIdentity, ClassRoundtripIdentity, IdentityCacheBenchmarkIdentity + * * @param {object} results - Results object to accumulate benchmark data * @param {function|null} nameFilter - Optional filter for benchmark names * @param {object|null} identityConfig - Identity benchmark configuration * @param {function} benchmarkRunner - Benchmark runner function from singleRun + * @param {object} exports - Exports from the main WASM instance */ -async function runIdentityModeBenchmarks(results, nameFilter, identityConfig, benchmarkRunner) { +async function runIdentityModeBenchmarks(results, nameFilter, identityConfig, benchmarkRunner, exports) { if (!identityConfig || identityConfig.modes.length === 0) return for (const mode of identityConfig.modes) { - const options = await defaultNodeSetup({}) - const { exports } = await instantiate({ - ...options, - identityMode: mode, - getImports: () => ({ - benchmarkHelperNoop: () => {}, - benchmarkHelperNoopWithNumber: () => {}, - benchmarkRunner: () => {}, - }), - }) + // Select the right class set based on mode + let classRoundtrip, baseObject, roundtrip, makeSimple, takeSimple + let SimpleClassCtor, IdentityCacheCtor - const classRoundtrip = new exports.ClassRoundtrip() - const baseObject = new exports.SimpleClass('Hello', 42, true, 0.5, 3.14159) + if (mode === 'pointer') { + classRoundtrip = new exports.ClassRoundtripIdentity() + baseObject = new exports.SimpleClassIdentity('Hello', 42, true, 0.5, 3.14159) + SimpleClassCtor = exports.SimpleClassIdentity + IdentityCacheCtor = exports.IdentityCacheBenchmarkIdentity + roundtrip = (obj) => classRoundtrip.roundtripSimpleClassIdentity(obj) + makeSimple = () => classRoundtrip.makeSimpleClassIdentity() + takeSimple = (obj) => classRoundtrip.takeSimpleClassIdentity(obj) + } else { + classRoundtrip = new exports.ClassRoundtrip() + baseObject = new exports.SimpleClass('Hello', 42, true, 0.5, 3.14159) + SimpleClassCtor = exports.SimpleClass + IdentityCacheCtor = exports.IdentityCacheBenchmark + roundtrip = (obj) => classRoundtrip.roundtripSimpleClass(obj) + makeSimple = () => classRoundtrip.makeSimpleClass() + takeSimple = (obj) => classRoundtrip.takeSimpleClass(obj) + } for (const poolSize of identityConfig.reusePools) { const pool = Array.from({ length: poolSize }, (_, i) => { - return new exports.SimpleClass(`Hello ${i}`, i, true, 0.5, 3.14159) + return new SimpleClassCtor(`Hello ${i}`, i, true, 0.5, 3.14159) }) const testName = poolSize === 1 ? `IdentityMode/${mode}/passBothWaysRoundtrip` @@ -159,7 +173,7 @@ async function runIdentityModeBenchmarks(results, nameFilter, identityConfig, be benchmarkRunner(testName, () => { for (let i = 0; i < identityConfig.iterations; i++) { const index = i % poolSize - pool[index] = classRoundtrip.roundtripSimpleClass(pool[index]) + pool[index] = roundtrip(pool[index]) } }) for (const object of pool) { @@ -169,27 +183,21 @@ async function runIdentityModeBenchmarks(results, nameFilter, identityConfig, be benchmarkRunner(`IdentityMode/${mode}/swiftConsumesSameObject`, () => { for (let i = 0; i < identityConfig.iterations; i++) { - classRoundtrip.takeSimpleClass(baseObject) + takeSimple(baseObject) } }) - // Churn scenario: create, roundtrip, release in a tight loop. - // Tests FinalizationRegistry cleanup overhead when objects are - // constantly created and dropped. In pointer mode, the identity - // cache accumulates WeakRef entries that must be cleaned up. benchmarkRunner(`IdentityMode/${mode}/churnObjects`, () => { for (let i = 0; i < identityConfig.iterations; i++) { - const obj = new exports.SimpleClass(`temp ${i}`, i, true, 0.5, 3.14159) - classRoundtrip.roundtripSimpleClass(obj) + const obj = new SimpleClassCtor(`temp ${i}`, i, true, 0.5, 3.14159) + roundtrip(obj) obj.release() } }) // Bulk array return: Swift returns same cached array of 100 objects. - // Tests the common pattern of returning model collections (e.g. building.floors). - // Uses fewer iterations since each call returns 100 objects. - const identityCacheBench = new exports.IdentityCacheBenchmark() + const identityCacheBench = new IdentityCacheCtor() identityCacheBench.setupPool(100) identityCacheBench.getPoolRepeated() // warm the cache benchmarkRunner(`IdentityMode/${mode}/getPoolRepeated_100`, () => { @@ -201,13 +209,13 @@ async function runIdentityModeBenchmarks(results, nameFilter, identityConfig, be benchmarkRunner(`IdentityMode/${mode}/swiftCreatesObject`, () => { for (let i = 0; i < identityConfig.iterations; i++) { - classRoundtrip.makeSimpleClass() + makeSimple() } }) if (identityConfig.memory) { const sample = await captureIdentityMemorySample( - classRoundtrip, baseObject, + roundtrip, baseObject, identityConfig.iterations, identityConfig.sampleInterval ) if (!identityConfig.memorySamples[mode]) { diff --git a/Benchmarks/run.js b/Benchmarks/run.js index f72ee6a47..f48fa8acf 100644 --- a/Benchmarks/run.js +++ b/Benchmarks/run.js @@ -903,7 +903,7 @@ async function singleRun(results, nameFilter, iterations, identityConfig) { } }) - await runIdentityModeBenchmarks(results, nameFilter, identityConfig, benchmarkRunner) + await runIdentityModeBenchmarks(results, nameFilter, identityConfig, benchmarkRunner, exports) } /** @@ -1004,6 +1004,8 @@ Options: --target-cv=NUMBER Target coefficient of variation % (default: 5) --filter=PATTERN Filter benchmarks by name (substring or /regex/flags) --identity-mode=MODE Identity benchmarks: off, none, pointer, both (default: off) + Both class variants are in the same build via per-class + @JS(identityMode: true). Use 'both' to compare side-by-side. --identity-iterations=N Iterations for identity benchmarks (default: 1000000) --identity-reuse-pools=N,N Pool sizes for reuse scenarios (default: 1,8,64) --identity-memory Enable memory profiling for identity benchmarks diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift index 404eef634..3d8f417e3 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift @@ -1197,6 +1197,14 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { return nil } + private func extractIdentityMode(from jsAttribute: AttributeSyntax) -> Bool? { + guard let arguments = jsAttribute.arguments?.as(LabeledExprListSyntax.self), + let identityArg = arguments.first(where: { $0.label?.text == "identityMode" }) + else { return nil } + let text = identityArg.expression.trimmedDescription + return text == "true" + } + override func visit(_ node: InitializerDeclSyntax) -> SyntaxVisitorContinueKind { guard let jsAttribute = node.attributes.firstJSAttribute else { return .skipChildren } @@ -1384,6 +1392,7 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { for: node, message: "Class visibility must be at least internal" ) + let classIdentityMode = extractIdentityMode(from: jsAttribute) let exportedClass = ExportedClass( name: name, swiftCallName: swiftCallName, @@ -1391,7 +1400,8 @@ private final class ExportSwiftAPICollector: SyntaxAnyVisitor { constructor: nil, methods: [], properties: [], - namespace: namespaceResult.namespace + namespace: namespaceResult.namespace, + identityMode: classIdentityMode ) let uniqueKey = makeKey(name: name, namespace: namespaceResult.namespace) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 2ee8cd869..db83d3987 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -25,6 +25,21 @@ public struct BridgeJSLink { self.sharedMemory = sharedMemory } + /// The identity mode from the config file, resolved from skeletons. + var configIdentityMode: String { + skeletons.compactMap(\.exported).compactMap(\.identityMode).first ?? "none" + } + + /// Whether a class should use identity caching based on its annotation and the config default. + private func shouldUseIdentityCache(for klass: ExportedClass) -> Bool { + // Per-class annotation takes priority + if let classOverride = klass.identityMode { + return classOverride + } + // Fall back to config default + return configIdentityMode == "pointer" + } + mutating func addSkeletonFile(data: Data) throws { do { let unified = try JSONDecoder().decode(BridgeJSSkeleton.self, from: data) @@ -110,7 +125,7 @@ public struct BridgeJSLink { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -937,7 +952,6 @@ public struct BridgeJSLink { printer.write("export function createInstantiator(options: {") printer.indent { printer.write("imports: Imports;") - printer.write("identityMode?: \"none\" | \"pointer\";") } printer.write("}, swift: any): Promise<{") printer.indent { @@ -983,11 +997,6 @@ public struct BridgeJSLink { try printer.indent { printer.write(lines: generateVariableDeclarations()) - let configIdentityMode = skeletons.compactMap(\.exported).compactMap(\.identityMode).first ?? "none" - printer.write("const identityMode = options.identityMode ?? \"\(configIdentityMode)\";") - printer.write( - "const shouldUseIdentityMap = identityMode === \"pointer\" && typeof WeakRef !== \"undefined\" && typeof FinalizationRegistry !== \"undefined\";" - ) let bodyPrinter = CodeFragmentPrinter() let allStructs = exportedSkeletons.flatMap { $0.structs } @@ -1993,18 +2002,45 @@ extension BridgeJSLink { dtsExportEntryPrinter.write("\(klass.name): {") jsPrinter.write("class \(klass.name) extends SwiftHeapObject {") - // Always add __construct and constructor methods for all classes + // Per-class identity mode: determine at codegen time whether this class uses identity caching + let useIdentity = shouldUseIdentityCache(for: klass) jsPrinter.indent { - jsPrinter.write("static __identityCache = new Map();") - jsPrinter.nextLine() + if useIdentity { + jsPrinter.write("static __identityCache = new Map();") + jsPrinter.nextLine() + } jsPrinter.write("static __construct(ptr) {") jsPrinter.indent { - jsPrinter.write( - "return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_\(klass.abiName)_deinit, \(klass.name).prototype, \(klass.name).__identityCache);" - ) + if useIdentity { + jsPrinter.write( + "return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_\(klass.abiName)_deinit, \(klass.name).prototype, \(klass.name).__identityCache);" + ) + } else { + jsPrinter.write( + "return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_\(klass.abiName)_deinit, \(klass.name).prototype, null);" + ) + } } jsPrinter.write("}") jsPrinter.nextLine() + // __constructFresh skips the identity cache lookup for newly created objects. + // Since the pointer is brand new, it cannot already be in the cache. + if useIdentity { + jsPrinter.write("static __constructFresh(ptr) {") + jsPrinter.indent { + jsPrinter.write("const obj = Object.create(\(klass.name).prototype);") + jsPrinter.write( + "const state = { pointer: ptr, deinit: instance.exports.bjs_\(klass.abiName)_deinit, hasReleased: false, identityMap: \(klass.name).__identityCache };" + ) + jsPrinter.write("obj.pointer = ptr;") + jsPrinter.write("obj.__swiftHeapObjectState = state;") + jsPrinter.write("swiftHeapObjectFinalizationRegistry.register(obj, state, state);") + jsPrinter.write("\(klass.name).__identityCache.set(ptr, new WeakRef(obj));") + jsPrinter.write("return obj;") + } + jsPrinter.write("}") + jsPrinter.nextLine() + } } if let constructor: ExportedConstructor = klass.constructor { @@ -2021,10 +2057,14 @@ extension BridgeJSLink { jsPrinter.indent { jsPrinter.write("constructor(\(constructorParamList)) {") let returnExpr = thunkBuilder.callConstructor(abiName: constructor.abiName) + let constructCall = + useIdentity + ? "\(klass.name).__constructFresh(\(returnExpr))" + : "\(klass.name).__construct(\(returnExpr))" jsPrinter.indent { thunkBuilder.renderFunctionBody( into: jsPrinter, - returnExpr: "\(klass.name).__construct(\(returnExpr))" + returnExpr: constructCall ) } jsPrinter.write("}") diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index f77b66043..03e6d676a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -784,6 +784,7 @@ public struct ExportedClass: Codable, NamespacedExportedType { public var methods: [ExportedFunction] public var properties: [ExportedProperty] public var namespace: [String]? + public var identityMode: Bool? // nil = use config default, true/false = override public init( name: String, @@ -792,7 +793,8 @@ public struct ExportedClass: Codable, NamespacedExportedType { constructor: ExportedConstructor? = nil, methods: [ExportedFunction], properties: [ExportedProperty] = [], - namespace: [String]? = nil + namespace: [String]? = nil, + identityMode: Bool? = nil ) { self.name = name self.swiftCallName = swiftCallName @@ -801,6 +803,7 @@ public struct ExportedClass: Codable, NamespacedExportedType { self.methods = methods self.properties = properties self.namespace = namespace + self.identityMode = identityMode } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index 8906cdeb3..64c9ae535 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -107,43 +107,51 @@ import Testing } @Test - func emitsIdentityModeOptionAndRuntimeScaffolding() throws { - let url = Self.inputsDirectory.appendingPathComponent("SwiftClass.swift") + func perClassIdentityModeFromAnnotation() throws { + let url = Self.inputsDirectory.appendingPathComponent("IdentityModeClass.swift") let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) - let swiftAPI = SwiftToSkeleton(progress: .silent, moduleName: "TestModule", exposeToGlobal: false) - swiftAPI.addSourceFile(sourceFile, inputFilePath: "SwiftClass.swift") - let outputSkeleton = try swiftAPI.finalize() - let bridgeJSLink = BridgeJSLink( - skeletons: [ - outputSkeleton - ], - sharedMemory: false + let swiftAPI = SwiftToSkeleton( + progress: .silent, + moduleName: "TestModule", + exposeToGlobal: false, + identityMode: nil // no config default ) + swiftAPI.addSourceFile(sourceFile, inputFilePath: "IdentityModeClass.swift") + let outputSkeleton = try swiftAPI.finalize() - let (outputJs, outputDts) = try bridgeJSLink.link() + // Verify skeleton has per-class identity mode (not captured by snapshots) + let cachedClass = outputSkeleton.exported!.classes.first { $0.name == "CachedModel" } + let uncachedClass = outputSkeleton.exported!.classes.first { $0.name == "UncachedModel" } + let explicitlyUncachedClass = outputSkeleton.exported!.classes.first { $0.name == "ExplicitlyUncachedModel" } + #expect(cachedClass?.identityMode == true) + #expect(uncachedClass?.identityMode == nil) + #expect(explicitlyUncachedClass?.identityMode == false) - #expect(outputDts.contains("identityMode?: \"none\" | \"pointer\";")) - #expect( - outputJs.contains("const identityMode = options.identityMode ?? \"none\";") - ) - #expect( - outputJs.contains( - "const shouldUseIdentityMap = identityMode === \"pointer\" && typeof WeakRef !== \"undefined\" && typeof FinalizationRegistry !== \"undefined\";" - ) - ) - #expect(outputJs.contains("if (!shouldUseIdentityMap) {")) - #expect(outputJs.contains("state.identityMap?.delete(state.pointer);")) - #expect(!outputJs.contains("static finalizerByDeinit")) - #expect(!outputJs.contains("static __getFinalizer")) - #expect(!outputJs.contains("static identityCache = new Map();")) - #expect(!outputJs.contains("identityCacheByDeinit")) - #expect(!outputJs.contains("identityCache ??")) - #expect(outputJs.contains("static __wrap(pointer, deinit, prototype, identityCache)")) - #expect(outputJs.contains("static __identityCache = new Map();")) - #expect( - outputJs.contains( - "return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache);" - ) + // Verify generated JS via snapshot + let bridgeJSLink = BridgeJSLink(skeletons: [outputSkeleton], sharedMemory: false) + try snapshot(bridgeJSLink: bridgeJSLink, name: "IdentityModeClass.PerClass") + } + + @Test + func perClassIdentityModeWithConfigOverride() throws { + let url = Self.inputsDirectory.appendingPathComponent("IdentityModeClass.swift") + let sourceFile = Parser.parse(source: try String(contentsOf: url, encoding: .utf8)) + let swiftAPI = SwiftToSkeleton( + progress: .silent, + moduleName: "TestModule", + exposeToGlobal: false, + identityMode: "pointer" // config says pointer for all classes ) + swiftAPI.addSourceFile(sourceFile, inputFilePath: "IdentityModeClass.swift") + let outputSkeleton = try swiftAPI.finalize() + + // When config says "pointer", classes without annotation get identity mode from config. + // But @JS(identityMode: false) should still override to "without identity". + let explicitlyUncachedClass = outputSkeleton.exported!.classes.first { $0.name == "ExplicitlyUncachedModel" } + #expect(explicitlyUncachedClass?.identityMode == false) + + // Verify generated JS via snapshot + let bridgeJSLink = BridgeJSLink(skeletons: [outputSkeleton], sharedMemory: false) + try snapshot(bridgeJSLink: bridgeJSLink, name: "IdentityModeClass.ConfigPointer") } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/IdentityModeClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/IdentityModeClass.swift new file mode 100644 index 000000000..4d50b6c76 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/MacroSwift/IdentityModeClass.swift @@ -0,0 +1,28 @@ +import JavaScriptKit + +@JS(identityMode: true) +class CachedModel { + @JS var name: String + + @JS init(name: String) { + self.name = name + } +} + +@JS +class UncachedModel { + @JS var value: Int + + @JS init(value: Int) { + self.value = value + } +} + +@JS(identityMode: false) +class ExplicitlyUncachedModel { + @JS var count: Int + + @JS init(count: Int) { + self.count = count + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.json new file mode 100644 index 000000000..d7a9064dc --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.json @@ -0,0 +1,148 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_CachedModel_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "identityMode" : true, + "methods" : [ + + ], + "name" : "CachedModel", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "CachedModel" + }, + { + "constructor" : { + "abiName" : "bjs_UncachedModel_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "UncachedModel", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "UncachedModel" + }, + { + "constructor" : { + "abiName" : "bjs_ExplicitlyUncachedModel_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "count", + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ] + }, + "identityMode" : false, + "methods" : [ + + ], + "name" : "ExplicitlyUncachedModel", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "integer" : { + "_0" : { + "isSigned" : true, + "width" : "word" + } + } + } + } + ], + "swiftCallName" : "ExplicitlyUncachedModel" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "moduleName" : "TestModule" +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.swift new file mode 100644 index 000000000..a79b91d56 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.swift @@ -0,0 +1,188 @@ +@_expose(wasm, "bjs_CachedModel_init") +@_cdecl("bjs_CachedModel_init") +public func _bjs_CachedModel_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = CachedModel(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CachedModel_name_get") +@_cdecl("bjs_CachedModel_name_get") +public func _bjs_CachedModel_name_get(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = CachedModel.bridgeJSLiftParameter(_self).name + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CachedModel_name_set") +@_cdecl("bjs_CachedModel_name_set") +public func _bjs_CachedModel_name_set(_ _self: UnsafeMutableRawPointer, _ valueBytes: Int32, _ valueLength: Int32) -> Void { + #if arch(wasm32) + CachedModel.bridgeJSLiftParameter(_self).name = String.bridgeJSLiftParameter(valueBytes, valueLength) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_CachedModel_deinit") +@_cdecl("bjs_CachedModel_deinit") +public func _bjs_CachedModel_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension CachedModel: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_CachedModel_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_CachedModel_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_CachedModel_wrap") +fileprivate func _bjs_CachedModel_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_CachedModel_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_CachedModel_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_CachedModel_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_UncachedModel_init") +@_cdecl("bjs_UncachedModel_init") +public func _bjs_UncachedModel_init(_ value: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = UncachedModel(value: Int.bridgeJSLiftParameter(value)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_UncachedModel_value_get") +@_cdecl("bjs_UncachedModel_value_get") +public func _bjs_UncachedModel_value_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = UncachedModel.bridgeJSLiftParameter(_self).value + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_UncachedModel_value_set") +@_cdecl("bjs_UncachedModel_value_set") +public func _bjs_UncachedModel_value_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + UncachedModel.bridgeJSLiftParameter(_self).value = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_UncachedModel_deinit") +@_cdecl("bjs_UncachedModel_deinit") +public func _bjs_UncachedModel_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension UncachedModel: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_UncachedModel_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_UncachedModel_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_UncachedModel_wrap") +fileprivate func _bjs_UncachedModel_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_UncachedModel_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_UncachedModel_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_UncachedModel_wrap_extern(pointer) +} + +@_expose(wasm, "bjs_ExplicitlyUncachedModel_init") +@_cdecl("bjs_ExplicitlyUncachedModel_init") +public func _bjs_ExplicitlyUncachedModel_init(_ count: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = ExplicitlyUncachedModel(count: Int.bridgeJSLiftParameter(count)) + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ExplicitlyUncachedModel_count_get") +@_cdecl("bjs_ExplicitlyUncachedModel_count_get") +public func _bjs_ExplicitlyUncachedModel_count_get(_ _self: UnsafeMutableRawPointer) -> Int32 { + #if arch(wasm32) + let ret = ExplicitlyUncachedModel.bridgeJSLiftParameter(_self).count + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ExplicitlyUncachedModel_count_set") +@_cdecl("bjs_ExplicitlyUncachedModel_count_set") +public func _bjs_ExplicitlyUncachedModel_count_set(_ _self: UnsafeMutableRawPointer, _ value: Int32) -> Void { + #if arch(wasm32) + ExplicitlyUncachedModel.bridgeJSLiftParameter(_self).count = Int.bridgeJSLiftParameter(value) + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_ExplicitlyUncachedModel_deinit") +@_cdecl("bjs_ExplicitlyUncachedModel_deinit") +public func _bjs_ExplicitlyUncachedModel_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension ExplicitlyUncachedModel: ConvertibleToJSValue, _BridgedSwiftHeapObject, _BridgedSwiftProtocolExportable { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_ExplicitlyUncachedModel_wrap(Unmanaged.passRetained(self).toOpaque())))) + } + consuming func bridgeJSLowerAsProtocolReturn() -> Int32 { + _bjs_ExplicitlyUncachedModel_wrap(Unmanaged.passRetained(self).toOpaque()) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "TestModule", name: "bjs_ExplicitlyUncachedModel_wrap") +fileprivate func _bjs_ExplicitlyUncachedModel_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_ExplicitlyUncachedModel_wrap_extern(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif +@inline(never) fileprivate func _bjs_ExplicitlyUncachedModel_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + return _bjs_ExplicitlyUncachedModel_wrap_extern(pointer) +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts index cf51c51f3..255249eef 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.d.ts @@ -88,7 +88,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 32d9126fc..8359220c9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -43,8 +43,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointHelpers = () => ({ lower: (value) => { f64Stack.push(value.x); @@ -369,7 +367,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -397,18 +395,14 @@ export async function createInstantiator(options, swift) { } } class Item extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Item_deinit, Item.prototype, Item.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Item_deinit, Item.prototype, null); } } class MultiArrayContainer extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MultiArrayContainer_deinit, MultiArrayContainer.prototype, MultiArrayContainer.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MultiArrayContainer_deinit, MultiArrayContainer.prototype, null); } constructor(nums, strs) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts index 29236eb44..aecab090e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.d.ts @@ -17,7 +17,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index c3a2a2e53..bf368738e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.d.ts index 46e521365..e612ae1e1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.d.ts @@ -16,7 +16,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js index 8f2a26d9b..89ab29827 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; function __bjs_jsValueLower(value) { let kind; let payload1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.d.ts index e93f46d69..491a66795 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.d.ts @@ -16,7 +16,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js index 4dec1f812..7fd6a0d6b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; function __bjs_jsValueLower(value) { let kind; let payload1; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts index dca39489e..ac5658eb3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.d.ts @@ -158,7 +158,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 3064e18a9..cafd250b0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -36,8 +36,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createConfigHelpers = () => ({ lower: (value) => { const bytes = textEncoder.encode(value.name); @@ -300,7 +298,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -328,10 +326,8 @@ export async function createInstantiator(options, swift) { } } class DefaultGreeter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DefaultGreeter_deinit, DefaultGreeter.prototype, DefaultGreeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DefaultGreeter_deinit, DefaultGreeter.prototype, null); } constructor(name) { @@ -353,10 +349,8 @@ export async function createInstantiator(options, swift) { } } class EmptyGreeter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_EmptyGreeter_deinit, EmptyGreeter.prototype, EmptyGreeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_EmptyGreeter_deinit, EmptyGreeter.prototype, null); } constructor() { @@ -365,10 +359,8 @@ export async function createInstantiator(options, swift) { } } class ConstructorDefaults extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_ConstructorDefaults_deinit, ConstructorDefaults.prototype, ConstructorDefaults.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_ConstructorDefaults_deinit, ConstructorDefaults.prototype, null); } constructor(name = "Default", count = 42, enabled = true, status = StatusValues.Active, tag = null) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts index d31cf3d66..f14b29aa4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.d.ts @@ -32,7 +32,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 100550c7e..920017972 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createCountersHelpers = () => ({ lower: (value) => { const bytes = textEncoder.encode(value.name); @@ -309,7 +307,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -337,10 +335,8 @@ export async function createInstantiator(options, swift) { } } class Box extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Box_deinit, Box.prototype, Box.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Box_deinit, Box.prototype, null); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts index eeb0cf428..13f77ae08 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.d.ts @@ -192,7 +192,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 375493923..3d2230c6c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -111,8 +111,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointHelpers = () => ({ lower: (value) => { f64Stack.push(value.x); @@ -976,7 +974,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -1004,10 +1002,8 @@ export async function createInstantiator(options, swift) { } } class User extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_User_deinit, User.prototype, User.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_User_deinit, User.prototype, null); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts index c403d38b4..5581df31e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.d.ts @@ -53,7 +53,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index 481a198db..fe94c046f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -54,8 +54,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts index 9fafb6f01..b78f0cecd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.d.ts @@ -151,7 +151,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 21dbd3c55..10fe31f64 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -74,8 +74,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -292,7 +290,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -320,10 +318,8 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converter_deinit, Converter.prototype, null); } constructor() { @@ -345,10 +341,8 @@ export async function createInstantiator(options, swift) { } } class HTTPServer extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_API_HTTPServer_deinit, HTTPServer.prototype, HTTPServer.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_API_HTTPServer_deinit, HTTPServer.prototype, null); } constructor() { @@ -360,10 +354,8 @@ export async function createInstantiator(options, swift) { } } class TestServer extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_APIV2_Internal_TestServer_deinit, TestServer.prototype, TestServer.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_APIV2_Internal_TestServer_deinit, TestServer.prototype, null); } constructor() { @@ -375,10 +367,8 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Formatting_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Formatting_Converter_deinit, Converter.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts index d8a145e3b..23d872d27 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.d.ts @@ -112,7 +112,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 7e7627d32..a6aeee4b0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -55,8 +55,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -273,7 +271,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -301,10 +299,8 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converter_deinit, Converter.prototype, null); } constructor() { @@ -326,10 +322,8 @@ export async function createInstantiator(options, swift) { } } class HTTPServer extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_API_HTTPServer_deinit, HTTPServer.prototype, HTTPServer.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_API_HTTPServer_deinit, HTTPServer.prototype, null); } constructor() { @@ -341,10 +335,8 @@ export async function createInstantiator(options, swift) { } } class TestServer extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_APIV2_Internal_TestServer_deinit, TestServer.prototype, TestServer.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Networking_APIV2_Internal_TestServer_deinit, TestServer.prototype, null); } constructor() { @@ -356,10 +348,8 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Formatting_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Formatting_Converter_deinit, Converter.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts index 92f043b9d..fbd5ad637 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.d.ts @@ -166,7 +166,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index f47ae00ce..7e5334811 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -105,8 +105,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts index 88ff36752..d6ab5aa8f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.d.ts @@ -26,7 +26,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js index 18cb1d34d..53ddd7301 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts index d138fcdde..312f56786 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.d.ts @@ -14,7 +14,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index 4f7732d63..346b74eac 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts index 12ac7a310..ae1152016 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.d.ts @@ -16,7 +16,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index aff235d10..f74095374 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.d.ts new file mode 100644 index 000000000..e5e2a3a84 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.d.ts @@ -0,0 +1,42 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +/// Represents a Swift heap object like a class instance or an actor instance. +export interface SwiftHeapObject { + /// Release the heap object. + /// + /// Note: Calling this method will release the heap object and it will no longer be accessible. + release(): void; +} +export interface CachedModel extends SwiftHeapObject { + name: string; +} +export interface UncachedModel extends SwiftHeapObject { + value: number; +} +export interface ExplicitlyUncachedModel extends SwiftHeapObject { + count: number; +} +export type Exports = { + CachedModel: { + new(name: string): CachedModel; + } + UncachedModel: { + new(value: number): UncachedModel; + } + ExplicitlyUncachedModel: { + new(count: number): ExplicitlyUncachedModel; + } +} +export type Imports = { +} +export function createInstantiator(options: { + imports: Imports; +}, swift: any): Promise<{ + addImports: (importObject: WebAssembly.Imports) => void; + setInstance: (instance: WebAssembly.Instance) => void; + createExports: (instance: WebAssembly.Instance) => Exports; +}>; \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.js new file mode 100644 index 000000000..7970a905d --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.js @@ -0,0 +1,362 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +export async function createInstantiator(options, swift) { + let instance; + let memory; + let setException; + let decodeString; + const textDecoder = new TextDecoder("utf-8"); + const textEncoder = new TextEncoder("utf-8"); + let tmpRetString; + let tmpRetBytes; + let tmpRetException; + let tmpRetOptionalBool; + let tmpRetOptionalInt; + let tmpRetOptionalFloat; + let tmpRetOptionalDouble; + let tmpRetOptionalHeapObject; + let strStack = []; + let i32Stack = []; + let i64Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + bjs["swift_js_return_string"] = function(ptr, len) { + tmpRetString = decodeString(ptr, len); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + swift.memory.release(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + return swift.memory.retain(decodeString(ptr, len)); + } + bjs["swift_js_init_memory_with_result"] = function(ptr, len) { + const target = new Uint8Array(memory.buffer, ptr, len); + target.set(tmpRetBytes); + tmpRetBytes = undefined; + } + bjs["swift_js_throw"] = function(id) { + tmpRetException = swift.memory.retainByRef(id); + } + bjs["swift_js_retain"] = function(id) { + return swift.memory.retainByRef(id); + } + bjs["swift_js_release"] = function(id) { + swift.memory.release(id); + } + bjs["swift_js_push_i32"] = function(v) { + i32Stack.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + f32Stack.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + f64Stack.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const value = decodeString(ptr, len); + strStack.push(value); + } + bjs["swift_js_pop_i32"] = function() { + return i32Stack.pop(); + } + bjs["swift_js_pop_f32"] = function() { + return f32Stack.pop(); + } + bjs["swift_js_pop_f64"] = function() { + return f64Stack.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + ptrStack.push(pointer); + } + bjs["swift_js_pop_pointer"] = function() { + return ptrStack.pop(); + } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } + bjs["swift_js_return_optional_bool"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalBool = null; + } else { + tmpRetOptionalBool = value !== 0; + } + } + bjs["swift_js_return_optional_int"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalInt = null; + } else { + tmpRetOptionalInt = value | 0; + } + } + bjs["swift_js_return_optional_float"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalFloat = null; + } else { + tmpRetOptionalFloat = Math.fround(value); + } + } + bjs["swift_js_return_optional_double"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalDouble = null; + } else { + tmpRetOptionalDouble = value; + } + } + bjs["swift_js_return_optional_string"] = function(isSome, ptr, len) { + if (isSome === 0) { + tmpRetString = null; + } else { + tmpRetString = decodeString(ptr, len); + } + } + bjs["swift_js_return_optional_object"] = function(isSome, objectId) { + if (isSome === 0) { + tmpRetString = null; + } else { + tmpRetString = swift.memory.getObject(objectId); + } + } + bjs["swift_js_return_optional_heap_object"] = function(isSome, pointer) { + if (isSome === 0) { + tmpRetOptionalHeapObject = null; + } else { + tmpRetOptionalHeapObject = pointer; + } + } + bjs["swift_js_get_optional_int_presence"] = function() { + return tmpRetOptionalInt != null ? 1 : 0; + } + bjs["swift_js_get_optional_int_value"] = function() { + const value = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return value; + } + bjs["swift_js_get_optional_string"] = function() { + const str = tmpRetString; + tmpRetString = undefined; + if (str == null) { + return -1; + } else { + const bytes = textEncoder.encode(str); + tmpRetBytes = bytes; + return bytes.length; + } + } + bjs["swift_js_get_optional_float_presence"] = function() { + return tmpRetOptionalFloat != null ? 1 : 0; + } + bjs["swift_js_get_optional_float_value"] = function() { + const value = tmpRetOptionalFloat; + tmpRetOptionalFloat = undefined; + return value; + } + bjs["swift_js_get_optional_double_presence"] = function() { + return tmpRetOptionalDouble != null ? 1 : 0; + } + bjs["swift_js_get_optional_double_value"] = function() { + const value = tmpRetOptionalDouble; + tmpRetOptionalDouble = undefined; + return value; + } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } + bjs["swift_js_closure_unregister"] = function(funcRef) {} + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_CachedModel_wrap"] = function(pointer) { + const obj = _exports['CachedModel'].__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_ExplicitlyUncachedModel_wrap"] = function(pointer) { + const obj = _exports['ExplicitlyUncachedModel'].__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_UncachedModel_wrap"] = function(pointer) { + const obj = _exports['UncachedModel'].__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + decodeString = (ptr, len) => { const bytes = new Uint8Array(memory.buffer, ptr >>> 0, len >>> 0); return textDecoder.decode(bytes); } + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype, identityCache) { + const makeFresh = (identityMap) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!identityCache) { + return makeFresh(null); + } + + const cached = identityCache.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); + return cached; + } + if (identityCache.has(pointer)) { + identityCache.delete(pointer); + } + + return makeFresh(identityCache); + } + + release() { + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + } + } + class CachedModel extends SwiftHeapObject { + static __identityCache = new Map(); + + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_CachedModel_deinit, CachedModel.prototype, CachedModel.__identityCache); + } + + static __constructFresh(ptr) { + const obj = Object.create(CachedModel.prototype); + const state = { pointer: ptr, deinit: instance.exports.bjs_CachedModel_deinit, hasReleased: false, identityMap: CachedModel.__identityCache }; + obj.pointer = ptr; + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); + CachedModel.__identityCache.set(ptr, new WeakRef(obj)); + return obj; + } + + constructor(name) { + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + const ret = instance.exports.bjs_CachedModel_init(nameId, nameBytes.length); + return CachedModel.__constructFresh(ret); + } + get name() { + instance.exports.bjs_CachedModel_name_get(this.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + set name(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_CachedModel_name_set(this.pointer, valueId, valueBytes.length); + } + } + class UncachedModel extends SwiftHeapObject { + static __identityCache = new Map(); + + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_UncachedModel_deinit, UncachedModel.prototype, UncachedModel.__identityCache); + } + + static __constructFresh(ptr) { + const obj = Object.create(UncachedModel.prototype); + const state = { pointer: ptr, deinit: instance.exports.bjs_UncachedModel_deinit, hasReleased: false, identityMap: UncachedModel.__identityCache }; + obj.pointer = ptr; + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); + UncachedModel.__identityCache.set(ptr, new WeakRef(obj)); + return obj; + } + + constructor(value) { + const ret = instance.exports.bjs_UncachedModel_init(value); + return UncachedModel.__constructFresh(ret); + } + get value() { + const ret = instance.exports.bjs_UncachedModel_value_get(this.pointer); + return ret; + } + set value(value) { + instance.exports.bjs_UncachedModel_value_set(this.pointer, value); + } + } + class ExplicitlyUncachedModel extends SwiftHeapObject { + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_ExplicitlyUncachedModel_deinit, ExplicitlyUncachedModel.prototype, null); + } + + constructor(count) { + const ret = instance.exports.bjs_ExplicitlyUncachedModel_init(count); + return ExplicitlyUncachedModel.__construct(ret); + } + get count() { + const ret = instance.exports.bjs_ExplicitlyUncachedModel_count_get(this.pointer); + return ret; + } + set count(value) { + instance.exports.bjs_ExplicitlyUncachedModel_count_set(this.pointer, value); + } + } + const exports = { + CachedModel, + UncachedModel, + ExplicitlyUncachedModel, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.d.ts new file mode 100644 index 000000000..e5e2a3a84 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.d.ts @@ -0,0 +1,42 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +/// Represents a Swift heap object like a class instance or an actor instance. +export interface SwiftHeapObject { + /// Release the heap object. + /// + /// Note: Calling this method will release the heap object and it will no longer be accessible. + release(): void; +} +export interface CachedModel extends SwiftHeapObject { + name: string; +} +export interface UncachedModel extends SwiftHeapObject { + value: number; +} +export interface ExplicitlyUncachedModel extends SwiftHeapObject { + count: number; +} +export type Exports = { + CachedModel: { + new(name: string): CachedModel; + } + UncachedModel: { + new(value: number): UncachedModel; + } + ExplicitlyUncachedModel: { + new(count: number): ExplicitlyUncachedModel; + } +} +export type Imports = { +} +export function createInstantiator(options: { + imports: Imports; +}, swift: any): Promise<{ + addImports: (importObject: WebAssembly.Imports) => void; + setInstance: (instance: WebAssembly.Instance) => void; + createExports: (instance: WebAssembly.Instance) => Exports; +}>; \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.js new file mode 100644 index 000000000..9025bf986 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.js @@ -0,0 +1,350 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +export async function createInstantiator(options, swift) { + let instance; + let memory; + let setException; + let decodeString; + const textDecoder = new TextDecoder("utf-8"); + const textEncoder = new TextEncoder("utf-8"); + let tmpRetString; + let tmpRetBytes; + let tmpRetException; + let tmpRetOptionalBool; + let tmpRetOptionalInt; + let tmpRetOptionalFloat; + let tmpRetOptionalDouble; + let tmpRetOptionalHeapObject; + let strStack = []; + let i32Stack = []; + let i64Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + bjs["swift_js_return_string"] = function(ptr, len) { + tmpRetString = decodeString(ptr, len); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + swift.memory.release(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + return swift.memory.retain(decodeString(ptr, len)); + } + bjs["swift_js_init_memory_with_result"] = function(ptr, len) { + const target = new Uint8Array(memory.buffer, ptr, len); + target.set(tmpRetBytes); + tmpRetBytes = undefined; + } + bjs["swift_js_throw"] = function(id) { + tmpRetException = swift.memory.retainByRef(id); + } + bjs["swift_js_retain"] = function(id) { + return swift.memory.retainByRef(id); + } + bjs["swift_js_release"] = function(id) { + swift.memory.release(id); + } + bjs["swift_js_push_i32"] = function(v) { + i32Stack.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + f32Stack.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + f64Stack.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const value = decodeString(ptr, len); + strStack.push(value); + } + bjs["swift_js_pop_i32"] = function() { + return i32Stack.pop(); + } + bjs["swift_js_pop_f32"] = function() { + return f32Stack.pop(); + } + bjs["swift_js_pop_f64"] = function() { + return f64Stack.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + ptrStack.push(pointer); + } + bjs["swift_js_pop_pointer"] = function() { + return ptrStack.pop(); + } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } + bjs["swift_js_return_optional_bool"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalBool = null; + } else { + tmpRetOptionalBool = value !== 0; + } + } + bjs["swift_js_return_optional_int"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalInt = null; + } else { + tmpRetOptionalInt = value | 0; + } + } + bjs["swift_js_return_optional_float"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalFloat = null; + } else { + tmpRetOptionalFloat = Math.fround(value); + } + } + bjs["swift_js_return_optional_double"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalDouble = null; + } else { + tmpRetOptionalDouble = value; + } + } + bjs["swift_js_return_optional_string"] = function(isSome, ptr, len) { + if (isSome === 0) { + tmpRetString = null; + } else { + tmpRetString = decodeString(ptr, len); + } + } + bjs["swift_js_return_optional_object"] = function(isSome, objectId) { + if (isSome === 0) { + tmpRetString = null; + } else { + tmpRetString = swift.memory.getObject(objectId); + } + } + bjs["swift_js_return_optional_heap_object"] = function(isSome, pointer) { + if (isSome === 0) { + tmpRetOptionalHeapObject = null; + } else { + tmpRetOptionalHeapObject = pointer; + } + } + bjs["swift_js_get_optional_int_presence"] = function() { + return tmpRetOptionalInt != null ? 1 : 0; + } + bjs["swift_js_get_optional_int_value"] = function() { + const value = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return value; + } + bjs["swift_js_get_optional_string"] = function() { + const str = tmpRetString; + tmpRetString = undefined; + if (str == null) { + return -1; + } else { + const bytes = textEncoder.encode(str); + tmpRetBytes = bytes; + return bytes.length; + } + } + bjs["swift_js_get_optional_float_presence"] = function() { + return tmpRetOptionalFloat != null ? 1 : 0; + } + bjs["swift_js_get_optional_float_value"] = function() { + const value = tmpRetOptionalFloat; + tmpRetOptionalFloat = undefined; + return value; + } + bjs["swift_js_get_optional_double_presence"] = function() { + return tmpRetOptionalDouble != null ? 1 : 0; + } + bjs["swift_js_get_optional_double_value"] = function() { + const value = tmpRetOptionalDouble; + tmpRetOptionalDouble = undefined; + return value; + } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } + bjs["swift_js_closure_unregister"] = function(funcRef) {} + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_CachedModel_wrap"] = function(pointer) { + const obj = _exports['CachedModel'].__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_ExplicitlyUncachedModel_wrap"] = function(pointer) { + const obj = _exports['ExplicitlyUncachedModel'].__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_UncachedModel_wrap"] = function(pointer) { + const obj = _exports['UncachedModel'].__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + decodeString = (ptr, len) => { const bytes = new Uint8Array(memory.buffer, ptr >>> 0, len >>> 0); return textDecoder.decode(bytes); } + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype, identityCache) { + const makeFresh = (identityMap) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!identityCache) { + return makeFresh(null); + } + + const cached = identityCache.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); + return cached; + } + if (identityCache.has(pointer)) { + identityCache.delete(pointer); + } + + return makeFresh(identityCache); + } + + release() { + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + } + } + class CachedModel extends SwiftHeapObject { + static __identityCache = new Map(); + + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_CachedModel_deinit, CachedModel.prototype, CachedModel.__identityCache); + } + + static __constructFresh(ptr) { + const obj = Object.create(CachedModel.prototype); + const state = { pointer: ptr, deinit: instance.exports.bjs_CachedModel_deinit, hasReleased: false, identityMap: CachedModel.__identityCache }; + obj.pointer = ptr; + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); + CachedModel.__identityCache.set(ptr, new WeakRef(obj)); + return obj; + } + + constructor(name) { + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + const ret = instance.exports.bjs_CachedModel_init(nameId, nameBytes.length); + return CachedModel.__constructFresh(ret); + } + get name() { + instance.exports.bjs_CachedModel_name_get(this.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + set name(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_CachedModel_name_set(this.pointer, valueId, valueBytes.length); + } + } + class UncachedModel extends SwiftHeapObject { + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_UncachedModel_deinit, UncachedModel.prototype, null); + } + + constructor(value) { + const ret = instance.exports.bjs_UncachedModel_init(value); + return UncachedModel.__construct(ret); + } + get value() { + const ret = instance.exports.bjs_UncachedModel_value_get(this.pointer); + return ret; + } + set value(value) { + instance.exports.bjs_UncachedModel_value_set(this.pointer, value); + } + } + class ExplicitlyUncachedModel extends SwiftHeapObject { + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_ExplicitlyUncachedModel_deinit, ExplicitlyUncachedModel.prototype, null); + } + + constructor(count) { + const ret = instance.exports.bjs_ExplicitlyUncachedModel_init(count); + return ExplicitlyUncachedModel.__construct(ret); + } + get count() { + const ret = instance.exports.bjs_ExplicitlyUncachedModel_count_get(this.pointer); + return ret; + } + set count(value) { + instance.exports.bjs_ExplicitlyUncachedModel_count_set(this.pointer, value); + } + } + const exports = { + CachedModel, + UncachedModel, + ExplicitlyUncachedModel, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.d.ts new file mode 100644 index 000000000..e5e2a3a84 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.d.ts @@ -0,0 +1,42 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +/// Represents a Swift heap object like a class instance or an actor instance. +export interface SwiftHeapObject { + /// Release the heap object. + /// + /// Note: Calling this method will release the heap object and it will no longer be accessible. + release(): void; +} +export interface CachedModel extends SwiftHeapObject { + name: string; +} +export interface UncachedModel extends SwiftHeapObject { + value: number; +} +export interface ExplicitlyUncachedModel extends SwiftHeapObject { + count: number; +} +export type Exports = { + CachedModel: { + new(name: string): CachedModel; + } + UncachedModel: { + new(value: number): UncachedModel; + } + ExplicitlyUncachedModel: { + new(count: number): ExplicitlyUncachedModel; + } +} +export type Imports = { +} +export function createInstantiator(options: { + imports: Imports; +}, swift: any): Promise<{ + addImports: (importObject: WebAssembly.Imports) => void; + setInstance: (instance: WebAssembly.Instance) => void; + createExports: (instance: WebAssembly.Instance) => Exports; +}>; \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.js new file mode 100644 index 000000000..9025bf986 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.js @@ -0,0 +1,350 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +export async function createInstantiator(options, swift) { + let instance; + let memory; + let setException; + let decodeString; + const textDecoder = new TextDecoder("utf-8"); + const textEncoder = new TextEncoder("utf-8"); + let tmpRetString; + let tmpRetBytes; + let tmpRetException; + let tmpRetOptionalBool; + let tmpRetOptionalInt; + let tmpRetOptionalFloat; + let tmpRetOptionalDouble; + let tmpRetOptionalHeapObject; + let strStack = []; + let i32Stack = []; + let i64Stack = []; + let f32Stack = []; + let f64Stack = []; + let ptrStack = []; + const enumHelpers = {}; + const structHelpers = {}; + + let _exports = null; + let bjs = null; + + return { + /** + * @param {WebAssembly.Imports} importObject + */ + addImports: (importObject, importsContext) => { + bjs = {}; + importObject["bjs"] = bjs; + bjs["swift_js_return_string"] = function(ptr, len) { + tmpRetString = decodeString(ptr, len); + } + bjs["swift_js_init_memory"] = function(sourceId, bytesPtr) { + const source = swift.memory.getObject(sourceId); + swift.memory.release(sourceId); + const bytes = new Uint8Array(memory.buffer, bytesPtr); + bytes.set(source); + } + bjs["swift_js_make_js_string"] = function(ptr, len) { + return swift.memory.retain(decodeString(ptr, len)); + } + bjs["swift_js_init_memory_with_result"] = function(ptr, len) { + const target = new Uint8Array(memory.buffer, ptr, len); + target.set(tmpRetBytes); + tmpRetBytes = undefined; + } + bjs["swift_js_throw"] = function(id) { + tmpRetException = swift.memory.retainByRef(id); + } + bjs["swift_js_retain"] = function(id) { + return swift.memory.retainByRef(id); + } + bjs["swift_js_release"] = function(id) { + swift.memory.release(id); + } + bjs["swift_js_push_i32"] = function(v) { + i32Stack.push(v | 0); + } + bjs["swift_js_push_f32"] = function(v) { + f32Stack.push(Math.fround(v)); + } + bjs["swift_js_push_f64"] = function(v) { + f64Stack.push(v); + } + bjs["swift_js_push_string"] = function(ptr, len) { + const value = decodeString(ptr, len); + strStack.push(value); + } + bjs["swift_js_pop_i32"] = function() { + return i32Stack.pop(); + } + bjs["swift_js_pop_f32"] = function() { + return f32Stack.pop(); + } + bjs["swift_js_pop_f64"] = function() { + return f64Stack.pop(); + } + bjs["swift_js_push_pointer"] = function(pointer) { + ptrStack.push(pointer); + } + bjs["swift_js_pop_pointer"] = function() { + return ptrStack.pop(); + } + bjs["swift_js_push_i64"] = function(v) { + i64Stack.push(v); + } + bjs["swift_js_pop_i64"] = function() { + return i64Stack.pop(); + } + bjs["swift_js_return_optional_bool"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalBool = null; + } else { + tmpRetOptionalBool = value !== 0; + } + } + bjs["swift_js_return_optional_int"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalInt = null; + } else { + tmpRetOptionalInt = value | 0; + } + } + bjs["swift_js_return_optional_float"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalFloat = null; + } else { + tmpRetOptionalFloat = Math.fround(value); + } + } + bjs["swift_js_return_optional_double"] = function(isSome, value) { + if (isSome === 0) { + tmpRetOptionalDouble = null; + } else { + tmpRetOptionalDouble = value; + } + } + bjs["swift_js_return_optional_string"] = function(isSome, ptr, len) { + if (isSome === 0) { + tmpRetString = null; + } else { + tmpRetString = decodeString(ptr, len); + } + } + bjs["swift_js_return_optional_object"] = function(isSome, objectId) { + if (isSome === 0) { + tmpRetString = null; + } else { + tmpRetString = swift.memory.getObject(objectId); + } + } + bjs["swift_js_return_optional_heap_object"] = function(isSome, pointer) { + if (isSome === 0) { + tmpRetOptionalHeapObject = null; + } else { + tmpRetOptionalHeapObject = pointer; + } + } + bjs["swift_js_get_optional_int_presence"] = function() { + return tmpRetOptionalInt != null ? 1 : 0; + } + bjs["swift_js_get_optional_int_value"] = function() { + const value = tmpRetOptionalInt; + tmpRetOptionalInt = undefined; + return value; + } + bjs["swift_js_get_optional_string"] = function() { + const str = tmpRetString; + tmpRetString = undefined; + if (str == null) { + return -1; + } else { + const bytes = textEncoder.encode(str); + tmpRetBytes = bytes; + return bytes.length; + } + } + bjs["swift_js_get_optional_float_presence"] = function() { + return tmpRetOptionalFloat != null ? 1 : 0; + } + bjs["swift_js_get_optional_float_value"] = function() { + const value = tmpRetOptionalFloat; + tmpRetOptionalFloat = undefined; + return value; + } + bjs["swift_js_get_optional_double_presence"] = function() { + return tmpRetOptionalDouble != null ? 1 : 0; + } + bjs["swift_js_get_optional_double_value"] = function() { + const value = tmpRetOptionalDouble; + tmpRetOptionalDouble = undefined; + return value; + } + bjs["swift_js_get_optional_heap_object_pointer"] = function() { + const pointer = tmpRetOptionalHeapObject; + tmpRetOptionalHeapObject = undefined; + return pointer || 0; + } + bjs["swift_js_closure_unregister"] = function(funcRef) {} + // Wrapper functions for module: TestModule + if (!importObject["TestModule"]) { + importObject["TestModule"] = {}; + } + importObject["TestModule"]["bjs_CachedModel_wrap"] = function(pointer) { + const obj = _exports['CachedModel'].__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_ExplicitlyUncachedModel_wrap"] = function(pointer) { + const obj = _exports['ExplicitlyUncachedModel'].__construct(pointer); + return swift.memory.retain(obj); + }; + importObject["TestModule"]["bjs_UncachedModel_wrap"] = function(pointer) { + const obj = _exports['UncachedModel'].__construct(pointer); + return swift.memory.retain(obj); + }; + }, + setInstance: (i) => { + instance = i; + memory = instance.exports.memory; + + decodeString = (ptr, len) => { const bytes = new Uint8Array(memory.buffer, ptr >>> 0, len >>> 0); return textDecoder.decode(bytes); } + + setException = (error) => { + instance.exports._swift_js_exception.value = swift.memory.retain(error) + } + }, + /** @param {WebAssembly.Instance} instance */ + createExports: (instance) => { + const js = swift.memory.heap; + const swiftHeapObjectFinalizationRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { + if (state.hasReleased) { + return; + } + state.hasReleased = true; + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + }); + + /// Represents a Swift heap object like a class instance or an actor instance. + class SwiftHeapObject { + static __wrap(pointer, deinit, prototype, identityCache) { + const makeFresh = (identityMap) => { + const obj = Object.create(prototype); + const state = { pointer, deinit, hasReleased: false, identityMap }; + obj.pointer = pointer; + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); + if (identityMap) { + identityMap.set(pointer, new WeakRef(obj)); + } + return obj; + }; + + if (!identityCache) { + return makeFresh(null); + } + + const cached = identityCache.get(pointer)?.deref(); + if (cached && !cached.__swiftHeapObjectState.hasReleased) { + deinit(pointer); + return cached; + } + if (identityCache.has(pointer)) { + identityCache.delete(pointer); + } + + return makeFresh(identityCache); + } + + release() { + const state = this.__swiftHeapObjectState; + if (state.hasReleased) { + return; + } + state.hasReleased = true; + swiftHeapObjectFinalizationRegistry.unregister(state); + state.identityMap?.delete(state.pointer); + state.deinit(state.pointer); + } + } + class CachedModel extends SwiftHeapObject { + static __identityCache = new Map(); + + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_CachedModel_deinit, CachedModel.prototype, CachedModel.__identityCache); + } + + static __constructFresh(ptr) { + const obj = Object.create(CachedModel.prototype); + const state = { pointer: ptr, deinit: instance.exports.bjs_CachedModel_deinit, hasReleased: false, identityMap: CachedModel.__identityCache }; + obj.pointer = ptr; + obj.__swiftHeapObjectState = state; + swiftHeapObjectFinalizationRegistry.register(obj, state, state); + CachedModel.__identityCache.set(ptr, new WeakRef(obj)); + return obj; + } + + constructor(name) { + const nameBytes = textEncoder.encode(name); + const nameId = swift.memory.retain(nameBytes); + const ret = instance.exports.bjs_CachedModel_init(nameId, nameBytes.length); + return CachedModel.__constructFresh(ret); + } + get name() { + instance.exports.bjs_CachedModel_name_get(this.pointer); + const ret = tmpRetString; + tmpRetString = undefined; + return ret; + } + set name(value) { + const valueBytes = textEncoder.encode(value); + const valueId = swift.memory.retain(valueBytes); + instance.exports.bjs_CachedModel_name_set(this.pointer, valueId, valueBytes.length); + } + } + class UncachedModel extends SwiftHeapObject { + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_UncachedModel_deinit, UncachedModel.prototype, null); + } + + constructor(value) { + const ret = instance.exports.bjs_UncachedModel_init(value); + return UncachedModel.__construct(ret); + } + get value() { + const ret = instance.exports.bjs_UncachedModel_value_get(this.pointer); + return ret; + } + set value(value) { + instance.exports.bjs_UncachedModel_value_set(this.pointer, value); + } + } + class ExplicitlyUncachedModel extends SwiftHeapObject { + static __construct(ptr) { + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_ExplicitlyUncachedModel_deinit, ExplicitlyUncachedModel.prototype, null); + } + + constructor(count) { + const ret = instance.exports.bjs_ExplicitlyUncachedModel_init(count); + return ExplicitlyUncachedModel.__construct(ret); + } + get count() { + const ret = instance.exports.bjs_ExplicitlyUncachedModel_count_get(this.pointer); + return ret; + } + set count(value) { + instance.exports.bjs_ExplicitlyUncachedModel_count_set(this.pointer, value); + } + } + const exports = { + CachedModel, + UncachedModel, + ExplicitlyUncachedModel, + }; + _exports = exports; + return exports; + }, + } +} \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts index 7b36ca3d8..5d1e2c4dc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.d.ts @@ -12,7 +12,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index 9971930a4..06cf6550e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts index a1067c2ef..22b4e6a1c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.d.ts @@ -23,7 +23,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index 041822b7f..c469fcb58 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createFooContainerHelpers = () => ({ lower: (value) => { let id; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts index af7e3ab7d..ac0e05a91 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.d.ts @@ -30,7 +30,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index b49a8922c..952197c2a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts index 80531f880..aaf227cf7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.d.ts @@ -24,7 +24,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 56b7a70e6..88a5adb38 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts index ab40d43c4..3b2b5de99 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.d.ts @@ -25,7 +25,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index 03b1a3cb8..10fafb7a0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts index 2b74659a9..f4c13c610 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.d.ts @@ -33,7 +33,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 1626f7c50..0258b63b6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; function __bjs_jsValueLower(value) { let kind; let payload1; @@ -363,7 +361,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -391,10 +389,8 @@ export async function createInstantiator(options, swift) { } } class JSValueHolder extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_JSValueHolder_deinit, JSValueHolder.prototype, JSValueHolder.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_JSValueHolder_deinit, JSValueHolder.prototype, null); } constructor(value, optionalValue) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts index b093041e7..7b4cc95e6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.d.ts @@ -26,7 +26,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 4dabe1466..195eef468 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -236,7 +234,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -264,10 +262,8 @@ export async function createInstantiator(options, swift) { } } class GlobalClass extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalAPI_GlobalClass_deinit, GlobalClass.prototype, GlobalClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalAPI_GlobalClass_deinit, GlobalClass.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts index c0b6b13bd..88485232e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.d.ts @@ -48,7 +48,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 35133ca32..ca54493f6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -244,7 +242,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -272,10 +270,8 @@ export async function createInstantiator(options, swift) { } } class GlobalClass extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalAPI_GlobalClass_deinit, GlobalClass.prototype, GlobalClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalAPI_GlobalClass_deinit, GlobalClass.prototype, null); } constructor() { @@ -290,10 +286,8 @@ export async function createInstantiator(options, swift) { } } class PrivateClass extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateAPI_PrivateClass_deinit, PrivateClass.prototype, PrivateClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateAPI_PrivateClass_deinit, PrivateClass.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts index 169a25c84..193857072 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.d.ts @@ -26,7 +26,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 81a878053..3551caab2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -236,7 +234,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -264,10 +262,8 @@ export async function createInstantiator(options, swift) { } } class PrivateClass extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateAPI_PrivateClass_deinit, PrivateClass.prototype, PrivateClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateAPI_PrivateClass_deinit, PrivateClass.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts index 242c11285..1353220bc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.d.ts @@ -100,7 +100,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index f18eaf4d5..a63df44be 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -248,7 +246,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -276,10 +274,8 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_Greeter_deinit, Greeter.prototype, null); } constructor(name) { @@ -306,10 +302,8 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converters_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converters_Converter_deinit, Converter.prototype, null); } constructor() { @@ -324,10 +318,8 @@ export async function createInstantiator(options, swift) { } } class UUID extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_UUID_deinit, UUID.prototype, UUID.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_UUID_deinit, UUID.prototype, null); } uuidString() { @@ -338,10 +330,8 @@ export async function createInstantiator(options, swift) { } } class Container extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Collections_Container_deinit, Container.prototype, Container.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Collections_Container_deinit, Container.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts index 62a62b273..6b2d65cd8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.d.ts @@ -59,7 +59,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index ef0f69b5e..32a325bda 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -248,7 +246,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -276,10 +274,8 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_Greeter_deinit, Greeter.prototype, null); } constructor(name) { @@ -306,10 +302,8 @@ export async function createInstantiator(options, swift) { } } class Converter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converters_Converter_deinit, Converter.prototype, Converter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Utils_Converters_Converter_deinit, Converter.prototype, null); } constructor() { @@ -324,10 +318,8 @@ export async function createInstantiator(options, swift) { } } class UUID extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_UUID_deinit, UUID.prototype, UUID.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs___Swift_Foundation_UUID_deinit, UUID.prototype, null); } uuidString() { @@ -338,10 +330,8 @@ export async function createInstantiator(options, swift) { } } class Container extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Collections_Container_deinit, Container.prototype, Container.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Collections_Container_deinit, Container.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts index 4b2944157..a5a6e16fb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.d.ts @@ -75,7 +75,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index c01c54626..5971c2fa8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -492,7 +490,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -520,10 +518,8 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, null); } constructor(name) { @@ -583,10 +579,8 @@ export async function createInstantiator(options, swift) { } } class OptionalPropertyHolder extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_OptionalPropertyHolder_deinit, OptionalPropertyHolder.prototype, OptionalPropertyHolder.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_OptionalPropertyHolder_deinit, OptionalPropertyHolder.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts index 2adda19be..961f97635 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.d.ts @@ -12,7 +12,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index abb362ce7..490f2b4e2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts index b524c9666..77e269d16 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.d.ts @@ -17,7 +17,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index a2f0d3e4c..bec07b959 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts index f7ffa5b66..8f65849ab 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.d.ts @@ -41,7 +41,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index dc3416dc8..7f840708e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -236,7 +234,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -264,10 +262,8 @@ export async function createInstantiator(options, swift) { } } class PropertyHolder extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyHolder_deinit, PropertyHolder.prototype, PropertyHolder.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyHolder_deinit, PropertyHolder.prototype, null); } constructor(intValue, floatValue, doubleValue, boolValue, stringValue, jsObject) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts index 1a8178c4f..27cd9212b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.d.ts @@ -116,7 +116,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index f0d2a2a06..9fb9b172b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -54,8 +54,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createResultValuesHelpers = () => ({ lower: (value) => { const enumTag = value.tag; @@ -596,7 +594,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -624,10 +622,8 @@ export async function createInstantiator(options, swift) { } } class Helper extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Helper_deinit, Helper.prototype, Helper.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Helper_deinit, Helper.prototype, null); } constructor(value) { @@ -646,10 +642,8 @@ export async function createInstantiator(options, swift) { } } class MyViewController extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MyViewController_deinit, MyViewController.prototype, MyViewController.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MyViewController_deinit, MyViewController.prototype, null); } constructor(delegate) { @@ -709,10 +703,8 @@ export async function createInstantiator(options, swift) { } } class DelegateManager extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DelegateManager_deinit, DelegateManager.prototype, DelegateManager.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DelegateManager_deinit, DelegateManager.prototype, null); } constructor(delegates) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.d.ts index 133982a77..6b7a9d28d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.d.ts @@ -31,7 +31,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js index 2d98e6115..aefdb5679 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } instance?.exports?.bjs_release_swift_closure(state.pointer); @@ -382,7 +380,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -410,10 +408,8 @@ export async function createInstantiator(options, swift) { } } class Widget extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Widget_deinit, Widget.prototype, Widget.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Widget_deinit, Widget.prototype, null); } constructor(name) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts index 6d1f908f8..5916e1648 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.d.ts @@ -70,7 +70,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index 2bdc3596a..ef685b8a4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -41,8 +41,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createAPIResultValuesHelpers = () => ({ lower: (value) => { const enumTag = value.tag; @@ -280,7 +278,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -308,10 +306,8 @@ export async function createInstantiator(options, swift) { } } class MathUtils extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype, MathUtils.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts index a49010973..c9cb26910 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.d.ts @@ -60,7 +60,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index d497f84f0..1fd066076 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -41,8 +41,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createAPIResultValuesHelpers = () => ({ lower: (value) => { const enumTag = value.tag; @@ -280,7 +278,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -308,10 +306,8 @@ export async function createInstantiator(options, swift) { } } class MathUtils extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype, MathUtils.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts index 336f5589d..fea3c4b59 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.d.ts @@ -65,7 +65,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index d1090525d..5800fcb56 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -35,8 +35,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -241,7 +239,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -269,10 +267,8 @@ export async function createInstantiator(options, swift) { } } class PropertyClass extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype, PropertyClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts index 2972749cf..4ce689edb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.d.ts @@ -51,7 +51,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index 81e15106d..b81255810 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -35,8 +35,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -241,7 +239,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -269,10 +267,8 @@ export async function createInstantiator(options, swift) { } } class PropertyClass extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype, PropertyClass.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype, null); } constructor() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts index 8e3a8f98f..5e45162a1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.d.ts @@ -14,7 +14,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index 239206e95..033f08cd2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts index 98ed8ce88..b43ff062c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.d.ts @@ -12,7 +12,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 2f8d3dd22..8187b9e92 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts index a450bf30f..6d590950c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.d.ts @@ -40,7 +40,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 47b6bc560..9ee57d692 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** @@ -264,7 +262,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -292,10 +290,8 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, null); } constructor(name) { @@ -350,18 +346,14 @@ export async function createInstantiator(options, swift) { } } class PublicGreeter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PublicGreeter_deinit, PublicGreeter.prototype, PublicGreeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PublicGreeter_deinit, PublicGreeter.prototype, null); } } class PackageGreeter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PackageGreeter_deinit, PackageGreeter.prototype, PackageGreeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PackageGreeter_deinit, PackageGreeter.prototype, null); } } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts index 73635c41d..ccc95eb3b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.d.ts @@ -97,7 +97,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 7020ab4ec..03a5504e4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -60,8 +60,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } instance?.exports?.bjs_release_swift_closure(state.pointer); @@ -923,7 +921,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -951,10 +949,8 @@ export async function createInstantiator(options, swift) { } } class Person extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Person_deinit, Person.prototype, Person.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Person_deinit, Person.prototype, null); } constructor(name) { @@ -965,10 +961,8 @@ export async function createInstantiator(options, swift) { } } class TestProcessor extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestProcessor_deinit, TestProcessor.prototype, TestProcessor.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestProcessor_deinit, TestProcessor.prototype, null); } constructor(transform) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts index f08b5ac48..ebf493910 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.d.ts @@ -12,7 +12,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 2724a6322..d9df868ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } instance?.exports?.bjs_release_swift_closure(state.pointer); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts index 0880baf02..bf4ebc71f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.d.ts @@ -86,7 +86,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index 525093444..abfb24d48 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -35,8 +35,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createDataPointHelpers = () => ({ lower: (value) => { f64Stack.push(value.x); @@ -505,7 +503,7 @@ export async function createInstantiator(options, swift) { return obj; }; - if (!shouldUseIdentityMap) { + if (!identityCache) { return makeFresh(null); } @@ -533,10 +531,8 @@ export async function createInstantiator(options, swift) { } } class Greeter extends SwiftHeapObject { - static __identityCache = new Map(); - static __construct(ptr) { - return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, Greeter.__identityCache); + return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype, null); } constructor(name) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts index cc963fe97..3677f1e44 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.d.ts @@ -15,7 +15,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index 092a49f9b..d4f1160f3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointHelpers = () => ({ lower: (value) => { i32Stack.push((value.x | 0)); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts index 1b9223753..9199ad1ae 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.d.ts @@ -11,7 +11,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index 5b07dae16..b2c381a03 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts index ac1c9b771..4f9aa4e4a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.d.ts @@ -31,7 +31,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index 181cc29a9..ef81ef69e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; const __bjs_createPointerFieldsHelpers = () => ({ lower: (value) => { ptrStack.push((value.raw | 0)); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts index 63276ca35..7acba67a0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.d.ts @@ -12,7 +12,6 @@ export type Imports = { } export function createInstantiator(options: { imports: Imports; - identityMode?: "none" | "pointer"; }, swift: any): Promise<{ addImports: (importObject: WebAssembly.Imports) => void; setInstance: (instance: WebAssembly.Instance) => void; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index 901732e48..97948b286 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -30,8 +30,6 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; - const identityMode = options.identityMode ?? "none"; - const shouldUseIdentityMap = identityMode === "pointer" && typeof WeakRef !== "undefined" && typeof FinalizationRegistry !== "undefined"; return { /** diff --git a/Plugins/PackageToJS/Templates/index.d.ts b/Plugins/PackageToJS/Templates/index.d.ts index 780d30845..f3491b4e3 100644 --- a/Plugins/PackageToJS/Templates/index.d.ts +++ b/Plugins/PackageToJS/Templates/index.d.ts @@ -15,12 +15,6 @@ export type Options = { */ getImports: () => Imports; /* #endif */ - /** - * Controls whether exported Swift class instances use pointer-based identity mapping. - * When set to "pointer", the same Swift heap pointer will always return the same JS wrapper object. - * Defaults to "none". - */ - identityMode?: "none" | "pointer"; }; /** diff --git a/Plugins/PackageToJS/Templates/index.js b/Plugins/PackageToJS/Templates/index.js index 1e0db0f53..7cde8edc9 100644 --- a/Plugins/PackageToJS/Templates/index.js +++ b/Plugins/PackageToJS/Templates/index.js @@ -9,18 +9,14 @@ import { defaultBrowserSetup /* #if USE_SHARED_MEMORY */, createDefaultWorkerFac /* #if TARGET_DEFAULT_PLATFORM_NODE */ /** @type {import('./index.d').init} */ async function initNode(_options) { - const { identityMode: _identityMode, ...rest } = _options || {}; /** @type {import('./platforms/node.d.ts').DefaultNodeSetupOptions} */ const options = { - ...rest, + ...(_options || {}), /* #if USE_SHARED_MEMORY */ spawnWorker: createDefaultWorkerFactoryForNode(), /* #endif */ }; const instantiateOptions = await defaultNodeSetup(options); - if (_options?.identityMode) { - instantiateOptions.identityMode = _options.identityMode; - } return await instantiate(instantiateOptions); } @@ -48,9 +44,6 @@ async function initBrowser(_options) { spawnWorker: createDefaultWorkerFactoryForBrowser() /* #endif */ }) - if (options?.identityMode) { - instantiateOptions.identityMode = options.identityMode; - } return await instantiate(instantiateOptions); } diff --git a/Plugins/PackageToJS/Templates/instantiate.d.ts b/Plugins/PackageToJS/Templates/instantiate.d.ts index 0caf328dc..8f6170beb 100644 --- a/Plugins/PackageToJS/Templates/instantiate.d.ts +++ b/Plugins/PackageToJS/Templates/instantiate.d.ts @@ -130,11 +130,6 @@ export type InstantiateOptions = { } ) => WebAssembly.Instance - /** - * Controls whether exported Swift class instances use pointer-based identity mapping. - * When set to "pointer", the same Swift heap pointer will always return the same JS wrapper object. - */ - identityMode?: "none" | "pointer" } /** diff --git a/Sources/JavaScriptKit/Macros.swift b/Sources/JavaScriptKit/Macros.swift index 67b3488bf..3189cdeab 100644 --- a/Sources/JavaScriptKit/Macros.swift +++ b/Sources/JavaScriptKit/Macros.swift @@ -113,7 +113,8 @@ public enum JSImportFrom: String { /// /// - Important: This feature is still experimental. No API stability is guaranteed, and the API may change in future releases. @attached(peer) -public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const) = Builtin.ExternalMacro +public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const, identityMode: Bool = false) = + Builtin.ExternalMacro /// A macro that generates a Swift getter that reads a value from JavaScript. /// diff --git a/Tests/JavaScriptEventLoopTests/JSClosure+AsyncTests.swift b/Tests/JavaScriptEventLoopTests/JSClosure+AsyncTests.swift index db093e549..164ad6727 100644 --- a/Tests/JavaScriptEventLoopTests/JSClosure+AsyncTests.swift +++ b/Tests/JavaScriptEventLoopTests/JSClosure+AsyncTests.swift @@ -62,49 +62,48 @@ class JSClosureAsyncTests: XCTestCase { // - Make JSObject a final-class // - Unify JSFunction and JSObject into JSValue // - Make JS(Oneshot)Closure as a wrapper of JSObject, not a subclass - /* - func testAsyncOneshotClosure() async throws { - let closure = JSOneshotClosure.async { _ in - return (42.0).jsValue - }.jsValue - let result = try await JSPromise( - from: closure.function!() - )!.value() - XCTAssertEqual(result, 42.0) - } - - func testAsyncOneshotClosureWithPriority() async throws { - let priority = UnsafeSendableBox(nil) - let closure = JSOneshotClosure.async(priority: .high) { _ in - priority.value = Task.currentPriority - return (42.0).jsValue - }.jsValue - let result = try await JSPromise(from: closure.function!())!.value() - XCTAssertEqual(result, 42.0) - XCTAssertEqual(priority.value, .high) - } - - @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - func testAsyncOneshotClosureWithTaskExecutor() async throws { - let executor = AnyTaskExecutor() - let closure = JSOneshotClosure.async(executorPreference: executor) { _ in - return (42.0).jsValue - }.jsValue - let result = try await JSPromise(from: closure.function!())!.value() - XCTAssertEqual(result, 42.0) - } - - @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - func testAsyncOneshotClosureWithTaskExecutorPreference() async throws { - let executor = AnyTaskExecutor() - let priority = UnsafeSendableBox(nil) - let closure = JSOneshotClosure.async(executorPreference: executor, priority: .high) { _ in - priority.value = Task.currentPriority - return (42.0).jsValue - }.jsValue - let result = try await JSPromise(from: closure.function!())!.value() - XCTAssertEqual(result, 42.0) - XCTAssertEqual(priority.value, .high) - } - */ + // + // func testAsyncOneshotClosure() async throws { + // let closure = JSOneshotClosure.async { _ in + // return (42.0).jsValue + // }.jsValue + // let result = try await JSPromise( + // from: closure.function!() + // )!.value() + // XCTAssertEqual(result, 42.0) + // } + // + // func testAsyncOneshotClosureWithPriority() async throws { + // let priority = UnsafeSendableBox(nil) + // let closure = JSOneshotClosure.async(priority: .high) { _ in + // priority.value = Task.currentPriority + // return (42.0).jsValue + // }.jsValue + // let result = try await JSPromise(from: closure.function!())!.value() + // XCTAssertEqual(result, 42.0) + // XCTAssertEqual(priority.value, .high) + // } + // + // @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) + // func testAsyncOneshotClosureWithTaskExecutor() async throws { + // let executor = AnyTaskExecutor() + // let closure = JSOneshotClosure.async(executorPreference: executor) { _ in + // return (42.0).jsValue + // }.jsValue + // let result = try await JSPromise(from: closure.function!())!.value() + // XCTAssertEqual(result, 42.0) + // } + // + // @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) + // func testAsyncOneshotClosureWithTaskExecutorPreference() async throws { + // let executor = AnyTaskExecutor() + // let priority = UnsafeSendableBox(nil) + // let closure = JSOneshotClosure.async(executorPreference: executor, priority: .high) { _ in + // priority.value = Task.currentPriority + // return (42.0).jsValue + // }.jsValue + // let result = try await JSPromise(from: closure.function!())!.value() + // XCTAssertEqual(result, 42.0) + // XCTAssertEqual(priority.value, .high) + // } } From d6325913b488cc0ca741091cb16fac87e1cc309b Mon Sep 17 00:00:00 2001 From: Krzysztof Rodak Date: Wed, 22 Apr 2026 12:25:50 +0200 Subject: [PATCH 14/14] feat: Swift-side per-class identity cache with JS import side channel Replace DataView shared memory flag with @_extern(wasm) JS import for signaling, following the existing BridgeJS intrinsics pattern (_swift_js_push_i32, _swift_js_return_optional_heap_object, etc). Per-class Set tracks exported pointers. On cache hit, thunk calls _swift_js_set_identity_ref(1) and returns passUnretained. JS checks the ref and skips deinit. Trade-off vs JS-only cache: Set.contains with SipHash on WASM adds ~20-30ns per crossing, exceeding the ~4-8ns deinit WASM call it replaces. Improves create-heavy paths by ~20% but regresses roundtrip by ~50%. --- Benchmarks/Sources/Generated/BridgeJS.swift | 42 +++- Benchmarks/run.js | 205 ++++++++++-------- .../Sources/BridgeJSCore/ExportSwift.swift | 65 +++++- .../Sources/BridgeJSLink/BridgeJSLink.swift | 50 ++++- .../IdentityModeClass.swift | 14 +- .../BridgeJSLinkTests/ArrayTypes.js | 6 +- .../__Snapshots__/BridgeJSLinkTests/Async.js | 4 + .../BridgeJSLinkTests/AsyncImport.js | 4 + .../BridgeJSLinkTests/AsyncStaticImport.js | 4 + .../BridgeJSLinkTests/DefaultParameters.js | 6 +- .../BridgeJSLinkTests/DictionaryTypes.js | 6 +- .../BridgeJSLinkTests/EnumAssociatedValue.js | 6 +- .../BridgeJSLinkTests/EnumCase.js | 4 + .../BridgeJSLinkTests/EnumNamespace.Global.js | 6 +- .../BridgeJSLinkTests/EnumNamespace.js | 6 +- .../BridgeJSLinkTests/EnumRawType.js | 4 + .../BridgeJSLinkTests/FixedWidthIntegers.js | 4 + .../BridgeJSLinkTests/GlobalGetter.js | 4 + .../BridgeJSLinkTests/GlobalThisImports.js | 4 + .../IdentityModeClass.ConfigPointer.js | 19 +- .../IdentityModeClass.PerClass.js | 19 +- .../BridgeJSLinkTests/IdentityModeClass.js | 19 +- .../BridgeJSLinkTests/ImportArray.js | 4 + .../ImportedTypeInExportedInterface.js | 4 + .../BridgeJSLinkTests/InvalidPropertyNames.js | 4 + .../BridgeJSLinkTests/JSClass.js | 4 + .../JSClassStaticFunctions.js | 4 + .../BridgeJSLinkTests/JSValue.js | 6 +- .../BridgeJSLinkTests/MixedGlobal.js | 6 +- .../BridgeJSLinkTests/MixedModules.js | 6 +- .../BridgeJSLinkTests/MixedPrivate.js | 6 +- .../BridgeJSLinkTests/Namespaces.Global.js | 6 +- .../BridgeJSLinkTests/Namespaces.js | 6 +- .../BridgeJSLinkTests/Optionals.js | 6 +- .../BridgeJSLinkTests/PrimitiveParameters.js | 4 + .../BridgeJSLinkTests/PrimitiveReturn.js | 4 + .../BridgeJSLinkTests/PropertyTypes.js | 6 +- .../BridgeJSLinkTests/Protocol.js | 6 +- .../BridgeJSLinkTests/ProtocolInClosure.js | 6 +- .../StaticFunctions.Global.js | 6 +- .../BridgeJSLinkTests/StaticFunctions.js | 6 +- .../StaticProperties.Global.js | 6 +- .../BridgeJSLinkTests/StaticProperties.js | 6 +- .../BridgeJSLinkTests/StringParameter.js | 4 + .../BridgeJSLinkTests/StringReturn.js | 4 + .../BridgeJSLinkTests/SwiftClass.js | 6 +- .../BridgeJSLinkTests/SwiftClosure.js | 6 +- .../BridgeJSLinkTests/SwiftClosureImports.js | 4 + .../BridgeJSLinkTests/SwiftStruct.js | 6 +- .../BridgeJSLinkTests/SwiftStructImports.js | 4 + .../__Snapshots__/BridgeJSLinkTests/Throws.js | 4 + .../BridgeJSLinkTests/UnsafePointer.js | 4 + .../VoidParameterVoidReturn.js | 4 + .../JavaScriptKit/BridgeJSIntrinsics.swift | 25 +++ .../Generated/BridgeJS.swift | 42 +++- 55 files changed, 593 insertions(+), 133 deletions(-) diff --git a/Benchmarks/Sources/Generated/BridgeJS.swift b/Benchmarks/Sources/Generated/BridgeJS.swift index e199e4a29..65737b55f 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1531,12 +1531,23 @@ fileprivate func _bjs_IdentityCacheBenchmark_wrap_extern(_ pointer: UnsafeMutabl return _bjs_IdentityCacheBenchmark_wrap_extern(pointer) } +nonisolated(unsafe) var _SimpleClassIdentity_identityExported: Set = [] + @_expose(wasm, "bjs_SimpleClassIdentity_init") @_cdecl("bjs_SimpleClassIdentity_init") public func _bjs_SimpleClassIdentity_init(_ nameBytes: Int32, _ nameLength: Int32, _ count: Int32, _ flag: Int32, _ rate: Float32, _ precise: Float64) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = SimpleClassIdentity(name: String.bridgeJSLiftParameter(nameBytes, nameLength), count: Int.bridgeJSLiftParameter(count), flag: Bool.bridgeJSLiftParameter(flag), rate: Float.bridgeJSLiftParameter(rate), precise: Double.bridgeJSLiftParameter(precise)) - return ret.bridgeJSLowerReturn() + return withExtendedLifetime(ret) { + let pointer = Unmanaged.passUnretained(ret).toOpaque() + if _SimpleClassIdentity_identityExported.contains(pointer) { + _swift_js_set_identity_ref(1) + return pointer + } + _SimpleClassIdentity_identityExported.insert(pointer) + _ = Unmanaged.passRetained(ret) + return pointer + } #else fatalError("Only available on WebAssembly") #endif @@ -1651,6 +1662,7 @@ public func _bjs_SimpleClassIdentity_precise_set(_ _self: UnsafeMutableRawPointe @_cdecl("bjs_SimpleClassIdentity_deinit") public func _bjs_SimpleClassIdentity_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) + _SimpleClassIdentity_identityExported.remove(pointer) Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") @@ -1678,12 +1690,23 @@ fileprivate func _bjs_SimpleClassIdentity_wrap_extern(_ pointer: UnsafeMutableRa return _bjs_SimpleClassIdentity_wrap_extern(pointer) } +nonisolated(unsafe) var _ClassRoundtripIdentity_identityExported: Set = [] + @_expose(wasm, "bjs_ClassRoundtripIdentity_init") @_cdecl("bjs_ClassRoundtripIdentity_init") public func _bjs_ClassRoundtripIdentity_init() -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = ClassRoundtripIdentity() - return ret.bridgeJSLowerReturn() + return withExtendedLifetime(ret) { + let pointer = Unmanaged.passUnretained(ret).toOpaque() + if _ClassRoundtripIdentity_identityExported.contains(pointer) { + _swift_js_set_identity_ref(1) + return pointer + } + _ClassRoundtripIdentity_identityExported.insert(pointer) + _ = Unmanaged.passRetained(ret) + return pointer + } #else fatalError("Only available on WebAssembly") #endif @@ -1725,6 +1748,7 @@ public func _bjs_ClassRoundtripIdentity_takeSimpleClassIdentity(_ _self: UnsafeM @_cdecl("bjs_ClassRoundtripIdentity_deinit") public func _bjs_ClassRoundtripIdentity_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) + _ClassRoundtripIdentity_identityExported.remove(pointer) Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") @@ -1752,12 +1776,23 @@ fileprivate func _bjs_ClassRoundtripIdentity_wrap_extern(_ pointer: UnsafeMutabl return _bjs_ClassRoundtripIdentity_wrap_extern(pointer) } +nonisolated(unsafe) var _IdentityCacheBenchmarkIdentity_identityExported: Set = [] + @_expose(wasm, "bjs_IdentityCacheBenchmarkIdentity_init") @_cdecl("bjs_IdentityCacheBenchmarkIdentity_init") public func _bjs_IdentityCacheBenchmarkIdentity_init() -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = IdentityCacheBenchmarkIdentity() - return ret.bridgeJSLowerReturn() + return withExtendedLifetime(ret) { + let pointer = Unmanaged.passUnretained(ret).toOpaque() + if _IdentityCacheBenchmarkIdentity_identityExported.contains(pointer) { + _swift_js_set_identity_ref(1) + return pointer + } + _IdentityCacheBenchmarkIdentity_identityExported.insert(pointer) + _ = Unmanaged.passRetained(ret) + return pointer + } #else fatalError("Only available on WebAssembly") #endif @@ -1788,6 +1823,7 @@ public func _bjs_IdentityCacheBenchmarkIdentity_getPoolRepeated(_ _self: UnsafeM @_cdecl("bjs_IdentityCacheBenchmarkIdentity_deinit") public func _bjs_IdentityCacheBenchmarkIdentity_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) + _IdentityCacheBenchmarkIdentity_identityExported.remove(pointer) Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") diff --git a/Benchmarks/run.js b/Benchmarks/run.js index f48fa8acf..444a33be0 100644 --- a/Benchmarks/run.js +++ b/Benchmarks/run.js @@ -3,7 +3,6 @@ import { defaultNodeSetup } from "./.build/plugins/PackageToJS/outputs/Package/p import fs from 'fs'; import path from 'path'; import { parseArgs } from "util"; -import { parseIdentityModes, parseIdentityReusePools, runIdentityModeBenchmarks, summarizeIdentityMemory } from "./lib/identity-benchmarks.js" import { APIResultValues as APIResult, ComplexResultValues as ComplexResult } from "./.build/plugins/PackageToJS/outputs/Package/bridge-js.js"; /** @@ -63,44 +62,17 @@ function createNameFilter(arg) { * @returns {number} Coefficient of variation as a percentage */ function calculateCV(values) { - if (values.length < 2) return 0 - const filtered = removeOutliers(values) - const sum = filtered.reduce((a, b) => a + b, 0) - const mean = sum / filtered.length - if (mean === 0) return 0 - const variance = filtered.reduce((a, b) => a + Math.pow(b - mean, 2), 0) / filtered.length - const stdDev = Math.sqrt(variance) - return (stdDev / mean) * 100 -} + if (values.length < 2) return 0; -/** - * Remove outliers using the IQR (interquartile range) method. - * Discards values below Q1-1.5*IQR or above Q3+1.5*IQR. - * Returns the filtered array (or the original if too few samples). - * @param {Array} values - Array of measurement values - * @returns {Array} Values with outliers removed - */ -function removeOutliers(values) { - if (values.length < 4) return values - const sorted = [...values].sort((a, b) => a - b) - const q1 = sorted[Math.floor(sorted.length * 0.25)] - const q3 = sorted[Math.floor(sorted.length * 0.75)] - const iqr = q3 - q1 - const lower = q1 - 1.5 * iqr - const upper = q3 + 1.5 * iqr - const filtered = values.filter(v => v >= lower && v <= upper) - return filtered.length > 0 ? filtered : values -} + const sum = values.reduce((a, b) => a + b, 0); + const mean = sum / values.length; -/** - * Calculate the median of an array of numbers - * @param {Array} values - Array of measurement values - * @returns {number} Median value - */ -function median(values) { - const sorted = [...values].sort((a, b) => a - b) - const mid = Math.floor(sorted.length / 2) - return sorted.length % 2 !== 0 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2 + if (mean === 0) return 0; + + const variance = values.reduce((a, b) => a + Math.pow(b - mean, 2), 0) / values.length; + const stdDev = Math.sqrt(variance); + + return (stdDev / mean) * 100; // Return as percentage } /** @@ -113,38 +85,33 @@ function calculateStatistics(results) { const consoleTable = []; for (const [name, times] of Object.entries(results)) { - const filtered = removeOutliers(times) - const sum = filtered.reduce((a, b) => a + b, 0) - const avg = sum / filtered.length - const med = median(filtered) - const min = Math.min(...filtered) - const max = Math.max(...filtered) - const variance = filtered.reduce((a, b) => a + Math.pow(b - avg, 2), 0) / filtered.length - const stdDev = Math.sqrt(variance) - const cv = (stdDev / avg) * 100 - const outliers = times.length - filtered.length + const sum = times.reduce((a, b) => a + b, 0); + const avg = sum / times.length; + const min = Math.min(...times); + const max = Math.max(...times); + const variance = times.reduce((a, b) => a + Math.pow(b - avg, 2), 0) / times.length; + const stdDev = Math.sqrt(variance); + const cv = (stdDev / avg) * 100; // Coefficient of variation as percentage formattedResults[name] = { "avg_ms": parseFloat(avg.toFixed(2)), - "median_ms": parseFloat(med.toFixed(2)), "min_ms": parseFloat(min.toFixed(2)), "max_ms": parseFloat(max.toFixed(2)), "stdDev_ms": parseFloat(stdDev.toFixed(2)), "cv_percent": parseFloat(cv.toFixed(2)), - "samples": filtered.length, - "outliers_removed": outliers, + "samples": times.length, "rawTimes_ms": times.map(t => parseFloat(t.toFixed(2))) - } + }; consoleTable.push({ Test: name, - 'Median (ms)': med.toFixed(2), 'Avg (ms)': avg.toFixed(2), 'Min (ms)': min.toFixed(2), 'Max (ms)': max.toFixed(2), + 'StdDev (ms)': stdDev.toFixed(2), 'CV (%)': cv.toFixed(2), - 'Samples': filtered.length + (outliers > 0 ? ` (-${outliers})` : '') - }) + 'Samples': times.length + }); } return { formattedResults, consoleTable }; @@ -308,7 +275,7 @@ function saveJsonResults(filePath, data) { * @param {number} iterations - Loop iterations per JS benchmark * @returns {Promise} */ -async function singleRun(results, nameFilter, iterations, identityConfig) { +async function singleRun(results, nameFilter, iterations) { const options = await defaultNodeSetup({}) const benchmarkRunner = (name, body) => { if (nameFilter && !nameFilter(name)) { @@ -903,7 +870,95 @@ async function singleRun(results, nameFilter, iterations, identityConfig) { } }) - await runIdentityModeBenchmarks(results, nameFilter, identityConfig, benchmarkRunner, exports) + // Identity mode benchmarks - compare classes with and without @JS(identityMode: true) + + // Non-identity baseline (mode = "none") + const classRoundtripNone = new exports.ClassRoundtrip() + const baseObjNone = new exports.SimpleClass('Hello', 42, true, 0.5, 3.14159) + + benchmarkRunner("Identity/none/passBothWaysRoundtrip", () => { + let current = baseObjNone + for (let i = 0; i < iterations; i++) { + current = classRoundtripNone.roundtripSimpleClass(current) + } + }) + + benchmarkRunner("Identity/none/swiftCreatesObject", () => { + for (let i = 0; i < iterations; i++) { + classRoundtripNone.makeSimpleClass() + } + }) + + benchmarkRunner("Identity/none/swiftConsumesSameObject", () => { + for (let i = 0; i < iterations; i++) { + classRoundtripNone.takeSimpleClass(baseObjNone) + } + }) + + benchmarkRunner("Identity/none/churnObjects", () => { + for (let i = 0; i < iterations; i++) { + const obj = new exports.SimpleClass(`temp ${i}`, i, true, 0.5, 3.14159) + classRoundtripNone.roundtripSimpleClass(obj) + obj.release() + } + }) + + const identityCacheNone = new exports.IdentityCacheBenchmark() + identityCacheNone.setupPool(100) + identityCacheNone.getPoolRepeated() // warm the cache + benchmarkRunner("Identity/none/getPoolRepeated_100", () => { + for (let i = 0; i < Math.floor(iterations / 100); i++) { + identityCacheNone.getPoolRepeated() + } + }) + identityCacheNone.release() + + baseObjNone.release() + classRoundtripNone.release() + + // Identity mode (mode = "pointer") + const classRoundtripId = new exports.ClassRoundtripIdentity() + const baseObjId = new exports.SimpleClassIdentity('Hello', 42, true, 0.5, 3.14159) + + benchmarkRunner("Identity/pointer/passBothWaysRoundtrip", () => { + let current = baseObjId + for (let i = 0; i < iterations; i++) { + current = classRoundtripId.roundtripSimpleClassIdentity(current) + } + }) + + benchmarkRunner("Identity/pointer/swiftCreatesObject", () => { + for (let i = 0; i < iterations; i++) { + classRoundtripId.makeSimpleClassIdentity() + } + }) + + benchmarkRunner("Identity/pointer/swiftConsumesSameObject", () => { + for (let i = 0; i < iterations; i++) { + classRoundtripId.takeSimpleClassIdentity(baseObjId) + } + }) + + benchmarkRunner("Identity/pointer/churnObjects", () => { + for (let i = 0; i < iterations; i++) { + const obj = new exports.SimpleClassIdentity(`temp ${i}`, i, true, 0.5, 3.14159) + classRoundtripId.roundtripSimpleClassIdentity(obj) + obj.release() + } + }) + + const identityCacheId = new exports.IdentityCacheBenchmarkIdentity() + identityCacheId.setupPool(100) + identityCacheId.getPoolRepeated() // warm the cache + benchmarkRunner("Identity/pointer/getPoolRepeated_100", () => { + for (let i = 0; i < Math.floor(iterations / 100); i++) { + identityCacheId.getPoolRepeated() + } + }) + identityCacheId.release() + + baseObjId.release() + classRoundtripId.release() } /** @@ -913,7 +968,7 @@ async function singleRun(results, nameFilter, iterations, identityConfig) { * @param {number} iterations - Loop iterations per JS benchmark * @returns {Promise} */ -async function runUntilStable(results, options, width, nameFilter, filterArg, iterations, identityConfig) { +async function runUntilStable(results, options, width, nameFilter, filterArg, iterations) { const { minRuns = 5, maxRuns = 50, @@ -932,7 +987,7 @@ async function runUntilStable(results, options, width, nameFilter, filterArg, it // Update progress with estimated completion updateProgress(runs, maxRuns, "Benchmark Progress:", width); - await singleRun(results, nameFilter, iterations, identityConfig); + await singleRun(results, nameFilter, iterations); runs++; if (runs === 1 && Object.keys(results).length === 0) { @@ -1003,12 +1058,6 @@ Options: --max-runs=NUMBER Maximum runs for adaptive sampling (default: 50) --target-cv=NUMBER Target coefficient of variation % (default: 5) --filter=PATTERN Filter benchmarks by name (substring or /regex/flags) - --identity-mode=MODE Identity benchmarks: off, none, pointer, both (default: off) - Both class variants are in the same build via per-class - @JS(identityMode: true). Use 'both' to compare side-by-side. - --identity-iterations=N Iterations for identity benchmarks (default: 1000000) - --identity-reuse-pools=N,N Pool sizes for reuse scenarios (default: 1,8,64) - --identity-memory Enable memory profiling for identity benchmarks --help Show this help message `); } @@ -1026,10 +1075,6 @@ async function main() { 'max-runs': { type: 'string', default: '50' }, 'target-cv': { type: 'string', default: '5' }, filter: { type: 'string' }, - 'identity-mode': { type: 'string', default: 'off' }, - 'identity-iterations': { type: 'string', default: '1000000' }, - 'identity-reuse-pools': { type: 'string' }, - 'identity-memory': { type: 'boolean', default: false } } }); @@ -1043,17 +1088,6 @@ async function main() { const filterArg = args.values.filter; const nameFilter = createNameFilter(filterArg); - const identityModes = parseIdentityModes(args.values['identity-mode']) - const identityIterations = parseInt(args.values['identity-iterations'], 10) - const identityConfig = identityModes.length > 0 ? { - modes: identityModes, - iterations: identityIterations, - reusePools: parseIdentityReusePools(args.values['identity-reuse-pools']), - memory: args.values['identity-memory'], - memorySamples: {}, - sampleInterval: 10000, - } : null - const iterations = parseInt(args.values.iterations, 10); if (isNaN(iterations) || iterations <= 0) { console.error('Invalid --iterations value:', args.values.iterations); @@ -1073,7 +1107,7 @@ async function main() { console.log(`Results will be saved to: ${args.values.output}`); } - await runUntilStable(results, options, width, nameFilter, filterArg, iterations, identityConfig) + await runUntilStable(results, options, width, nameFilter, filterArg, iterations) } else { // Fixed number of runs mode const runs = parseInt(args.values.runs, 10); @@ -1095,7 +1129,7 @@ async function main() { console.log("\nOverall Progress:"); for (let i = 0; i < runs; i++) { updateProgress(i, runs, "Benchmark Runs:", width); - await singleRun(results, nameFilter, iterations, identityConfig) + await singleRun(results, nameFilter, iterations) if (i === 0 && Object.keys(results).length === 0) { process.stdout.write("\n"); console.error(`No benchmarks matched filter: ${filterArg}`); @@ -1127,15 +1161,6 @@ async function main() { } } - // Identity memory summary - if (identityConfig?.memory) { - const memoryRows = summarizeIdentityMemory(identityConfig) - if (memoryRows.length > 0) { - console.log("\n=== Identity Mode Memory Profile ===") - console.table(memoryRows) - } - } - // Save JSON to file if specified if (args.values.output) { saveJsonResults(args.values.output, formattedResults); diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index b649b244d..09fa1e02a 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -31,6 +31,14 @@ public class ExportSwift { self.skeleton = skeleton } + /// Whether a class should use identity caching based on its annotation and the config default. + private func shouldUseIdentityCache(for klass: ExportedClass) -> Bool { + if let classOverride = klass.identityMode { + return classOverride + } + return skeleton.identityMode == "pointer" + } + /// Finalizes the export process and generates the bridge code /// /// - Parameters: @@ -103,6 +111,9 @@ public class ExportSwift { var abiReturnType: WasmCoreType? var externDecls: [DeclSyntax] = [] let effects: Effects + /// When set, heap object returns use the per-class identity Set pattern + /// instead of the default `bridgeJSLowerReturn()`. + var identityClassName: String? init(effects: Effects) { self.effects = effects @@ -323,6 +334,25 @@ public class ExportSwift { } """ ) + case .swiftHeapObject(let className): + if let identityClass = identityClassName, identityClass == className { + append( + """ + return withExtendedLifetime(ret) { + let pointer = Unmanaged.passUnretained(ret).toOpaque() + if _\(raw: identityClass)_identityExported.contains(pointer) { + _swift_js_set_identity_ref(1) + return pointer + } + _\(raw: identityClass)_identityExported.insert(pointer) + _ = Unmanaged.passRetained(ret) + return pointer + } + """ + ) + } else { + append("return ret.bridgeJSLowerReturn()") + } default: append("return ret.bridgeJSLowerReturn()") } @@ -534,9 +564,11 @@ public class ExportSwift { private func renderSingleExportedConstructor( constructor: ExportedConstructor, callName: String, - returnType: BridgeType + returnType: BridgeType, + identityClassName: String? = nil ) throws -> DeclSyntax { let builder = ExportedThunkBuilder(effects: constructor.effects) + builder.identityClassName = identityClassName for param in constructor.parameters { try builder.liftParameter(param: param) } @@ -548,9 +580,11 @@ public class ExportSwift { private func renderSingleExportedMethod( method: ExportedFunction, ownerTypeName: String, - instanceSelfType: BridgeType + instanceSelfType: BridgeType, + identityClassName: String? = nil ) throws -> DeclSyntax { let builder = ExportedThunkBuilder(effects: method.effects) + builder.identityClassName = identityClassName if !method.effects.isStatic { try builder.liftParameter(param: Parameter(label: nil, name: "_self", type: instanceSelfType)) } @@ -652,21 +686,31 @@ public class ExportSwift { func renderSingleExportedClass(klass: ExportedClass) throws -> [DeclSyntax] { var decls: [DeclSyntax] = [] - if let constructor = klass.constructor { + let useIdentity = shouldUseIdentityCache(for: klass) + + // For identity-mode classes, emit the per-class Set + if useIdentity { decls.append( - try renderSingleExportedConstructor( - constructor: constructor, - callName: klass.swiftCallName, - returnType: .swiftHeapObject(klass.name) - ) + "nonisolated(unsafe) var _\(raw: klass.name)_identityExported: Set = []" ) } + + if let constructor = klass.constructor { + let constructorDecl = try renderSingleExportedConstructor( + constructor: constructor, + callName: klass.swiftCallName, + returnType: .swiftHeapObject(klass.name), + identityClassName: useIdentity ? klass.name : nil + ) + decls.append(constructorDecl) + } for method in klass.methods { decls.append( try renderSingleExportedMethod( method: method, ownerTypeName: klass.swiftCallName, - instanceSelfType: .swiftHeapObject(klass.swiftCallName) + instanceSelfType: .swiftHeapObject(klass.swiftCallName), + identityClassName: useIdentity ? klass.name : nil ) ) } @@ -686,6 +730,9 @@ public class ExportSwift { returnType: nil ) ) { printer in + if useIdentity { + printer.write("_\(klass.name)_identityExported.remove(pointer)") + } printer.write("Unmanaged<\(klass.swiftCallName)>.fromOpaque(pointer).release()") } decls.append(DeclSyntax(funcDecl)) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index db83d3987..9187b4c82 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -83,6 +83,13 @@ public struct BridgeJSLink { }; """ + /// Whether any class across all skeletons uses identity caching. + private var hasAnyIdentityClass: Bool { + skeletons.compactMap(\.exported).contains { skeleton in + skeleton.classes.contains { shouldUseIdentityCache(for: $0) } + } + } + var swiftHeapObjectClassJs: String { var output = "" if enableLifetimeTracking { @@ -131,13 +138,44 @@ public struct BridgeJSLink { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + + """ + if hasAnyIdentityClass { + output += """ + // __bjs_identity_ref is set by Swift via import call before returning + // If non-zero, Swift didn't retain (cache hit on Swift side) + if (__bjs_identity_ref !== 0) { + __bjs_identity_ref = 0; // reset for next call + // Swift didn't retain, no deinit needed + } else { + deinit(pointer); // Swift retained, balance it + } + + """ + } else { + output += " deinit(pointer);\n" + } + output += """ return cached; } if (identityCache.has(pointer)) { identityCache.delete(pointer); } + """ + if hasAnyIdentityClass { + output += """ + + { + if (__bjs_identity_ref !== 0) { + __bjs_identity_ref = 0; + \(JSGlueVariableScope.reservedInstance).exports.bjs_identity_retain(pointer); + } + } + """ + } + output += """ + return makeFresh(identityCache); } @@ -350,6 +388,7 @@ public struct BridgeJSLink { "", "let _exports = null;", "let bjs = null;", + "let __bjs_identity_ref = 0;", ] } @@ -477,6 +516,11 @@ public struct BridgeJSLink { printer.write("return \(JSGlueVariableScope.reservedPointerStack).pop();") } printer.write("}") + printer.write("bjs[\"swift_js_set_identity_ref\"] = function(refId) {") + printer.indent { + printer.write("__bjs_identity_ref = refId;") + } + printer.write("}") printer.write("bjs[\"swift_js_push_i64\"] = function(v) {") printer.indent { printer.write("\(JSGlueVariableScope.reservedI64Stack).push(v);") @@ -981,6 +1025,9 @@ public struct BridgeJSLink { printer.write(lines: data.topLevelTypeLines) let exportedSkeletons = skeletons.compactMap(\.exported) + let hasAnyIdentityClass = exportedSkeletons.contains { skeleton in + skeleton.classes.contains { shouldUseIdentityCache(for: $0) } + } let topLevelNamespaceCode = namespaceBuilder.buildTopLevelNamespaceInitialization( exportedSkeletons: exportedSkeletons ) @@ -1087,6 +1134,7 @@ public struct BridgeJSLink { ) } printer.write("}") + } printer.write("},") } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.swift index a79b91d56..8c6e34a95 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/IdentityModeClass.swift @@ -1,9 +1,20 @@ +nonisolated(unsafe) var _CachedModel_identityExported: Set = [] + @_expose(wasm, "bjs_CachedModel_init") @_cdecl("bjs_CachedModel_init") public func _bjs_CachedModel_init(_ nameBytes: Int32, _ nameLength: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = CachedModel(name: String.bridgeJSLiftParameter(nameBytes, nameLength)) - return ret.bridgeJSLowerReturn() + return withExtendedLifetime(ret) { + let pointer = Unmanaged.passUnretained(ret).toOpaque() + if _CachedModel_identityExported.contains(pointer) { + _swift_js_set_identity_ref(1) + return pointer + } + _CachedModel_identityExported.insert(pointer) + _ = Unmanaged.passRetained(ret) + return pointer + } #else fatalError("Only available on WebAssembly") #endif @@ -34,6 +45,7 @@ public func _bjs_CachedModel_name_set(_ _self: UnsafeMutableRawPointer, _ valueB @_cdecl("bjs_CachedModel_deinit") public func _bjs_CachedModel_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) + _CachedModel_identityExported.remove(pointer) Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index 8359220c9..345e0a513 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -43,6 +43,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createPointHelpers = () => ({ lower: (value) => { f64Stack.push(value.x); @@ -117,6 +118,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -373,7 +377,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index bf368738e..6db4d0c05 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js index 89ab29827..1cbab848a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncImport.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; function __bjs_jsValueLower(value) { let kind; let payload1; @@ -207,6 +208,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js index 7fd6a0d6b..d4264b92a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/AsyncStaticImport.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; function __bjs_jsValueLower(value) { let kind; let payload1; @@ -206,6 +207,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index cafd250b0..fa4755ba8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -36,6 +36,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createConfigHelpers = () => ({ lower: (value) => { const bytes = textEncoder.encode(value.name); @@ -134,6 +135,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -304,7 +308,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js index 920017972..0f00a3314 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DictionaryTypes.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createCountersHelpers = () => ({ lower: (value) => { const bytes = textEncoder.encode(value.name); @@ -133,6 +134,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -313,7 +317,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 3d2230c6c..7f3629a26 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -111,6 +111,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createPointHelpers = () => ({ lower: (value) => { f64Stack.push(value.x); @@ -825,6 +826,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -980,7 +984,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index fe94c046f..02a46419c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -54,6 +54,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -116,6 +117,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index 10fe31f64..3c2377f9e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -74,6 +74,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -136,6 +137,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -296,7 +300,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index a6aeee4b0..429914c1e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -55,6 +55,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -117,6 +118,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -277,7 +281,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 7e5334811..2b7171708 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -105,6 +105,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -168,6 +169,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js index 53ddd7301..8f6dc941f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/FixedWidthIntegers.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index 346b74eac..6d7526664 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index f74095374..64c4a0e5b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.js index 7970a905d..7ea6ab06a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.ConfigPointer.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -248,13 +252,26 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + // __bjs_identity_ref is set by Swift via import call before returning + // If non-zero, Swift didn't retain (cache hit on Swift side) + if (__bjs_identity_ref !== 0) { + __bjs_identity_ref = 0; // reset for next call + // Swift didn't retain, no deinit needed + } else { + deinit(pointer); // Swift retained, balance it + } return cached; } if (identityCache.has(pointer)) { identityCache.delete(pointer); } + { + if (__bjs_identity_ref !== 0) { + __bjs_identity_ref = 0; + instance.exports.bjs_identity_retain(pointer); + } + } return makeFresh(identityCache); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.js index 9025bf986..2cf4398be 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.PerClass.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -248,13 +252,26 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + // __bjs_identity_ref is set by Swift via import call before returning + // If non-zero, Swift didn't retain (cache hit on Swift side) + if (__bjs_identity_ref !== 0) { + __bjs_identity_ref = 0; // reset for next call + // Swift didn't retain, no deinit needed + } else { + deinit(pointer); // Swift retained, balance it + } return cached; } if (identityCache.has(pointer)) { identityCache.delete(pointer); } + { + if (__bjs_identity_ref !== 0) { + __bjs_identity_ref = 0; + instance.exports.bjs_identity_retain(pointer); + } + } return makeFresh(identityCache); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.js index 9025bf986..2cf4398be 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/IdentityModeClass.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -248,13 +252,26 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + // __bjs_identity_ref is set by Swift via import call before returning + // If non-zero, Swift didn't retain (cache hit on Swift side) + if (__bjs_identity_ref !== 0) { + __bjs_identity_ref = 0; // reset for next call + // Swift didn't retain, no deinit needed + } else { + deinit(pointer); // Swift retained, balance it + } return cached; } if (identityCache.has(pointer)) { identityCache.delete(pointer); } + { + if (__bjs_identity_ref !== 0) { + __bjs_identity_ref = 0; + instance.exports.bjs_identity_retain(pointer); + } + } return makeFresh(identityCache); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js index 06cf6550e..4859f49e8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportArray.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index c469fcb58..f07121ae6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createFooContainerHelpers = () => ({ lower: (value) => { let id; @@ -131,6 +132,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index 952197c2a..f52f94aa0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 88a5adb38..0956a8203 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index 10fafb7a0..35e2e505d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js index 0258b63b6..6dd77473a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSValue.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; function __bjs_jsValueLower(value) { let kind; let payload1; @@ -182,6 +183,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -367,7 +371,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index 195eef468..72bedbb0b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -240,7 +244,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index ca54493f6..a1638284d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -248,7 +252,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 3551caab2..bf957ec80 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -240,7 +244,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index a63df44be..895c0232d 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -252,7 +256,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index 32a325bda..1657245e0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -252,7 +256,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 5971c2fa8..4f0647d8c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -496,7 +500,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index 490f2b4e2..fdf69dde6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index bec07b959..4a1856caf 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index 7f840708e..a199437bc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -240,7 +244,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 9fb9b172b..dbd00bd67 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -54,6 +54,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createResultValuesHelpers = () => ({ lower: (value) => { const enumTag = value.tag; @@ -149,6 +150,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -600,7 +604,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js index aefdb5679..7d9e44815 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ProtocolInClosure.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } instance?.exports?.bjs_release_swift_closure(state.pointer); @@ -117,6 +118,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -386,7 +390,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index ef685b8a4..b56ab6867 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -41,6 +41,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createAPIResultValuesHelpers = () => ({ lower: (value) => { const enumTag = value.tag; @@ -136,6 +137,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -284,7 +288,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 1fd066076..4f51ddae5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -41,6 +41,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createAPIResultValuesHelpers = () => ({ lower: (value) => { const enumTag = value.tag; @@ -136,6 +137,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -284,7 +288,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 5800fcb56..50124af7a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -35,6 +35,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -97,6 +98,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -245,7 +249,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index b81255810..08ae24c77 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -35,6 +35,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -97,6 +98,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -245,7 +249,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index 033f08cd2..ee1a9fb6f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 8187b9e92..bf3c037ba 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index 9ee57d692..3561daae9 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -268,7 +272,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 03a5504e4..e0deae50f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -60,6 +60,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } instance?.exports?.bjs_release_swift_closure(state.pointer); @@ -208,6 +209,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -927,7 +931,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index d9df868ec..f9f759e3b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const swiftClosureRegistry = (typeof FinalizationRegistry === "undefined") ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => { if (state.unregistered) { return; } instance?.exports?.bjs_release_swift_closure(state.pointer); @@ -118,6 +119,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index abfb24d48..73e7cc3d5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -35,6 +35,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createDataPointHelpers = () => ({ lower: (value) => { f64Stack.push(value.x); @@ -305,6 +306,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } @@ -509,7 +513,7 @@ export async function createInstantiator(options, swift) { const cached = identityCache.get(pointer)?.deref(); if (cached && !cached.__swiftHeapObjectState.hasReleased) { - deinit(pointer); + deinit(pointer); return cached; } if (identityCache.has(pointer)) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index d4f1160f3..cf5069ebb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createPointHelpers = () => ({ lower: (value) => { i32Stack.push((value.x | 0)); @@ -104,6 +105,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index b2c381a03..5dd7df82e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -92,6 +93,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index ef81ef69e..cf40e8b6c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; const __bjs_createPointerFieldsHelpers = () => ({ lower: (value) => { ptrStack.push((value.raw | 0)); @@ -109,6 +110,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index 97948b286..118f34359 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -30,6 +30,7 @@ export async function createInstantiator(options, swift) { let _exports = null; let bjs = null; + let __bjs_identity_ref = 0; return { /** @@ -93,6 +94,9 @@ export async function createInstantiator(options, swift) { bjs["swift_js_pop_pointer"] = function() { return ptrStack.pop(); } + bjs["swift_js_set_identity_ref"] = function(refId) { + __bjs_identity_ref = refId; + } bjs["swift_js_push_i64"] = function(v) { i64Stack.push(v); } diff --git a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift index 867d0e835..418a27ecf 100644 --- a/Sources/JavaScriptKit/BridgeJSIntrinsics.swift +++ b/Sources/JavaScriptKit/BridgeJSIntrinsics.swift @@ -54,6 +54,31 @@ private func _swift_js_throw_extern(_ id: Int32) { #endif } +// MARK: Identity Cache Side Channel + +#if arch(wasm32) +@_extern(wasm, module: "bjs", name: "swift_js_set_identity_ref") +private func _swift_js_set_identity_ref_extern(_ refId: Int32) +#else +private func _swift_js_set_identity_ref_extern(_ refId: Int32) { + _onlyAvailableOnWasm() +} +#endif + +/// Tells JS to use a cached wrapper instead of creating a new one. +/// Called by identity-mode thunks on cache hit. JS reads this before +/// calling __construct — if non-zero, returns the cached wrapper directly. +@_spi(BridgeJS) @inline(never) public func _swift_js_set_identity_ref(_ refId: Int32) { + _swift_js_set_identity_ref_extern(refId) +} + +/// JS calls this when its cache is stale but Swift didn't retain (race recovery). +@_expose(wasm, "bjs_identity_retain") +@_cdecl("bjs_identity_retain") +public func _bjs_identity_retain(_ pointer: UnsafeMutableRawPointer) { + _ = Unmanaged.fromOpaque(pointer).retain() +} + /// Releases a Swift closure from the FinalizationRegistry /// /// This function is called by the BridgeJS code generator when a Swift closure is released. diff --git a/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift b/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift index e25ebeb4c..34edb28ac 100644 --- a/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift +++ b/Tests/BridgeJSIdentityTests/Generated/BridgeJS.swift @@ -133,12 +133,23 @@ public func _bjs_clearArrayPool() -> Void { #endif } +nonisolated(unsafe) var _IdentityTestSubject_identityExported: Set = [] + @_expose(wasm, "bjs_IdentityTestSubject_init") @_cdecl("bjs_IdentityTestSubject_init") public func _bjs_IdentityTestSubject_init(_ value: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = IdentityTestSubject(value: Int.bridgeJSLiftParameter(value)) - return ret.bridgeJSLowerReturn() + return withExtendedLifetime(ret) { + let pointer = Unmanaged.passUnretained(ret).toOpaque() + if _IdentityTestSubject_identityExported.contains(pointer) { + _swift_js_set_identity_ref(1) + return pointer + } + _IdentityTestSubject_identityExported.insert(pointer) + _ = Unmanaged.passRetained(ret) + return pointer + } #else fatalError("Only available on WebAssembly") #endif @@ -180,6 +191,7 @@ public func _bjs_IdentityTestSubject_currentValue_get(_ _self: UnsafeMutableRawP @_cdecl("bjs_IdentityTestSubject_deinit") public func _bjs_IdentityTestSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) + _IdentityTestSubject_identityExported.remove(pointer) Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") @@ -207,12 +219,23 @@ fileprivate func _bjs_IdentityTestSubject_wrap_extern(_ pointer: UnsafeMutableRa return _bjs_IdentityTestSubject_wrap_extern(pointer) } +nonisolated(unsafe) var _RetainLeakSubject_identityExported: Set = [] + @_expose(wasm, "bjs_RetainLeakSubject_init") @_cdecl("bjs_RetainLeakSubject_init") public func _bjs_RetainLeakSubject_init(_ tag: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = RetainLeakSubject(tag: Int.bridgeJSLiftParameter(tag)) - return ret.bridgeJSLowerReturn() + return withExtendedLifetime(ret) { + let pointer = Unmanaged.passUnretained(ret).toOpaque() + if _RetainLeakSubject_identityExported.contains(pointer) { + _swift_js_set_identity_ref(1) + return pointer + } + _RetainLeakSubject_identityExported.insert(pointer) + _ = Unmanaged.passRetained(ret) + return pointer + } #else fatalError("Only available on WebAssembly") #endif @@ -243,6 +266,7 @@ public func _bjs_RetainLeakSubject_tag_set(_ _self: UnsafeMutableRawPointer, _ v @_cdecl("bjs_RetainLeakSubject_deinit") public func _bjs_RetainLeakSubject_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) + _RetainLeakSubject_identityExported.remove(pointer) Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly") @@ -270,12 +294,23 @@ fileprivate func _bjs_RetainLeakSubject_wrap_extern(_ pointer: UnsafeMutableRawP return _bjs_RetainLeakSubject_wrap_extern(pointer) } +nonisolated(unsafe) var _ArrayIdentityElement_identityExported: Set = [] + @_expose(wasm, "bjs_ArrayIdentityElement_init") @_cdecl("bjs_ArrayIdentityElement_init") public func _bjs_ArrayIdentityElement_init(_ tag: Int32) -> UnsafeMutableRawPointer { #if arch(wasm32) let ret = ArrayIdentityElement(tag: Int.bridgeJSLiftParameter(tag)) - return ret.bridgeJSLowerReturn() + return withExtendedLifetime(ret) { + let pointer = Unmanaged.passUnretained(ret).toOpaque() + if _ArrayIdentityElement_identityExported.contains(pointer) { + _swift_js_set_identity_ref(1) + return pointer + } + _ArrayIdentityElement_identityExported.insert(pointer) + _ = Unmanaged.passRetained(ret) + return pointer + } #else fatalError("Only available on WebAssembly") #endif @@ -306,6 +341,7 @@ public func _bjs_ArrayIdentityElement_tag_set(_ _self: UnsafeMutableRawPointer, @_cdecl("bjs_ArrayIdentityElement_deinit") public func _bjs_ArrayIdentityElement_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { #if arch(wasm32) + _ArrayIdentityElement_identityExported.remove(pointer) Unmanaged.fromOpaque(pointer).release() #else fatalError("Only available on WebAssembly")