From 25c4b6137f1c187f0582154f9ec606257a41c809 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Feb 2026 18:41:41 +0900 Subject: [PATCH] [NFC] BridgeJS: Omit trailing spaces on empty lines in generated JS code When generating JavaScript code, avoid adding trailing spaces to empty lines. --- .../BridgeJSLink/CodeFragmentPrinter.swift | 5 ++ .../BridgeJSCodegenTests/Optionals.json | 3 + .../BridgeJSLinkTests/ArrayTypes.js | 8 +-- .../__Snapshots__/BridgeJSLinkTests/Async.js | 2 +- .../BridgeJSLinkTests/DefaultParameters.js | 14 ++--- .../BridgeJSLinkTests/EnumAssociatedValue.js | 12 ++-- .../BridgeJSLinkTests/EnumCase.js | 2 +- .../BridgeJSLinkTests/EnumNamespace.Global.js | 10 +-- .../BridgeJSLinkTests/EnumNamespace.js | 10 +-- .../BridgeJSLinkTests/EnumRawType.js | 2 +- .../BridgeJSLinkTests/GlobalGetter.js | 2 +- .../BridgeJSLinkTests/GlobalThisImports.js | 2 +- .../ImportedTypeInExportedInterface.js | 4 +- .../BridgeJSLinkTests/InvalidPropertyNames.js | 2 +- .../BridgeJSLinkTests/JSClass.js | 2 +- .../JSClassStaticFunctions.js | 2 +- .../BridgeJSLinkTests/MixedGlobal.js | 6 +- .../BridgeJSLinkTests/MixedModules.js | 8 +-- .../BridgeJSLinkTests/MixedPrivate.js | 6 +- .../BridgeJSLinkTests/Namespaces.Global.js | 10 +-- .../BridgeJSLinkTests/Namespaces.js | 10 +-- .../BridgeJSLinkTests/Optionals.js | 8 +-- .../BridgeJSLinkTests/PrimitiveParameters.js | 2 +- .../BridgeJSLinkTests/PrimitiveReturn.js | 2 +- .../BridgeJSLinkTests/PropertyTypes.js | 6 +- .../BridgeJSLinkTests/Protocol.js | 12 ++-- .../StaticFunctions.Global.js | 8 +-- .../BridgeJSLinkTests/StaticFunctions.js | 8 +-- .../StaticProperties.Global.js | 6 +- .../BridgeJSLinkTests/StaticProperties.js | 6 +- .../BridgeJSLinkTests/StringParameter.js | 2 +- .../BridgeJSLinkTests/StringReturn.js | 2 +- .../BridgeJSLinkTests/SwiftClass.js | 10 +-- .../BridgeJSLinkTests/SwiftClosure.js | 62 +++++++++---------- .../BridgeJSLinkTests/SwiftClosureImports.js | 6 +- .../BridgeJSLinkTests/SwiftStruct.js | 20 +++--- .../BridgeJSLinkTests/SwiftStructImports.js | 4 +- .../__Snapshots__/BridgeJSLinkTests/Throws.js | 2 +- .../BridgeJSLinkTests/UnsafePointer.js | 4 +- .../VoidParameterVoidReturn.js | 2 +- 40 files changed, 151 insertions(+), 143 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift index c4624e694..258a0ad18 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swift @@ -12,6 +12,11 @@ final class CodeFragmentPrinter { } func write(_ line: S) { + if line.isEmpty { + // Empty lines should not have trailing spaces + lines.append("") + return + } lines.append(String(repeating: " ", count: indentLevel * 4) + String(line)) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json index f74b3cdf7..9c99bb8c4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSCodegenTests/Optionals.json @@ -1220,6 +1220,9 @@ } } } + ], + "staticMethods" : [ + ] } ] diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js index da5920660..491fc610e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ArrayTypes.js @@ -44,7 +44,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; const __bjs_createPointHelpers = () => { @@ -288,7 +288,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -298,11 +298,11 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Item_deinit, Item.prototype); } - + } const PointHelpers = __bjs_createPointHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.Point = PointHelpers; - + const exports = { Item, processIntArray: function bjs_processIntArray(values) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js index 4015b6261..d5a195430 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Async.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js index 978272568..bc669993b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/DefaultParameters.js @@ -37,7 +37,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; const __bjs_createConfigHelpers = () => { @@ -317,7 +317,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -327,7 +327,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DefaultGreeter_deinit, DefaultGreeter.prototype); } - + constructor(name) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); @@ -352,7 +352,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_EmptyGreeter_deinit, EmptyGreeter.prototype); } - + constructor() { const ret = instance.exports.bjs_EmptyGreeter_init(); return EmptyGreeter.__construct(ret); @@ -362,7 +362,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_ConstructorDefaults_deinit, ConstructorDefaults.prototype); } - + constructor(name = "Default", count = 42, enabled = true, status = StatusValues.Active, tag = null) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); @@ -433,10 +433,10 @@ export async function createInstantiator(options, swift) { } const ConfigHelpers = __bjs_createConfigHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.Config = ConfigHelpers; - + const MathOperationsHelpers = __bjs_createMathOperationsHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.MathOperations = MathOperationsHelpers; - + const exports = { DefaultGreeter, EmptyGreeter, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js index 2d8dbc0ca..6eb4b3985 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumAssociatedValue.js @@ -506,7 +506,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -683,19 +683,19 @@ export async function createInstantiator(options, swift) { const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); enumHelpers.APIResult = APIResultHelpers; - + const ComplexResultHelpers = __bjs_createComplexResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); enumHelpers.ComplexResult = ComplexResultHelpers; - + const ResultHelpers = __bjs_createResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); enumHelpers.Result = ResultHelpers; - + const NetworkingResultHelpers = __bjs_createNetworkingResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); enumHelpers.NetworkingResult = NetworkingResultHelpers; - + const APIOptionalResultHelpers = __bjs_createAPIOptionalResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); enumHelpers.APIOptionalResult = APIOptionalResultHelpers; - + setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js index 89a0f0897..874b4c4c0 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumCase.js @@ -55,7 +55,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js index f48a0050e..78f08ffb5 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.Global.js @@ -75,7 +75,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -286,7 +286,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -296,7 +296,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype); } - + constructor() { const ret = instance.exports.bjs_Converter_init(); return Converter.__construct(ret); @@ -312,7 +312,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_HTTPServer_deinit, HTTPServer.prototype); } - + constructor() { const ret = instance.exports.bjs_HTTPServer_init(); return HTTPServer.__construct(ret); @@ -325,7 +325,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestServer_deinit, TestServer.prototype); } - + constructor() { const ret = instance.exports.bjs_TestServer_init(); return TestServer.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js index 1eb483365..cddeac767 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumNamespace.js @@ -56,7 +56,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -267,7 +267,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -277,7 +277,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype); } - + constructor() { const ret = instance.exports.bjs_Converter_init(); return Converter.__construct(ret); @@ -293,7 +293,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_HTTPServer_deinit, HTTPServer.prototype); } - + constructor() { const ret = instance.exports.bjs_HTTPServer_init(); return HTTPServer.__construct(ret); @@ -306,7 +306,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestServer_deinit, TestServer.prototype); } - + constructor() { const ret = instance.exports.bjs_TestServer_init(); return TestServer.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js index 1e137e6eb..315b74262 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/EnumRawType.js @@ -106,7 +106,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js index b3b809476..b5053b266 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalGetter.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js index 35a3d76ec..0d9eb79c3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/GlobalThisImports.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js index e4ce9e8fe..11aa2b3d8 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/ImportedTypeInExportedInterface.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; const __bjs_createFooContainerHelpers = () => { @@ -300,7 +300,7 @@ export async function createInstantiator(options, swift) { const js = swift.memory.heap; const FooContainerHelpers = __bjs_createFooContainerHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.FooContainer = FooContainerHelpers; - + const exports = { makeFoo: function bjs_makeFoo() { const ret = instance.exports.bjs_makeFoo(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js index ab030062a..6a11003b3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js index 5b7541b1c..b60a698b4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClass.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js index f8f0ba86f..214a32294 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/JSClassStaticFunctions.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js index f079de1da..e1345f94b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedGlobal.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -234,7 +234,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -244,7 +244,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalClass_deinit, GlobalClass.prototype); } - + constructor() { const ret = instance.exports.bjs_GlobalClass_init(); return GlobalClass.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js index 2c43b91e8..0703be789 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedModules.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -242,7 +242,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -252,7 +252,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_GlobalClass_deinit, GlobalClass.prototype); } - + constructor() { const ret = instance.exports.bjs_GlobalClass_init(); return GlobalClass.__construct(ret); @@ -268,7 +268,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateClass_deinit, PrivateClass.prototype); } - + constructor() { const ret = instance.exports.bjs_PrivateClass_init(); return PrivateClass.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js index 4b8ce8a66..0cc377f4c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MixedPrivate.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -234,7 +234,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -244,7 +244,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PrivateClass_deinit, PrivateClass.prototype); } - + constructor() { const ret = instance.exports.bjs_PrivateClass_init(); return PrivateClass.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js index 671868eab..630651aea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.Global.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -242,7 +242,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -252,7 +252,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype); } - + constructor(name) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); @@ -271,7 +271,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype); } - + constructor() { const ret = instance.exports.bjs_Converter_init(); return Converter.__construct(ret); @@ -287,7 +287,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_UUID_deinit, UUID.prototype); } - + uuidString() { instance.exports.bjs_UUID_uuidString(this.pointer); const ret = tmpRetString; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js index ae7bf7451..b3073da70 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Namespaces.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -242,7 +242,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -252,7 +252,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype); } - + constructor(name) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); @@ -271,7 +271,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Converter_deinit, Converter.prototype); } - + constructor() { const ret = instance.exports.bjs_Converter_init(); return Converter.__construct(ret); @@ -287,7 +287,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_UUID_deinit, UUID.prototype); } - + uuidString() { instance.exports.bjs_UUID_uuidString(this.pointer); const ret = tmpRetString; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js index 0ec2f81c9..27e9c3c6b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Optionals.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -506,7 +506,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -516,7 +516,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype); } - + constructor(name) { const isSome = name != null; let nameId, nameBytes; @@ -571,7 +571,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_OptionalPropertyHolder_deinit, OptionalPropertyHolder.prototype); } - + constructor() { const ret = instance.exports.bjs_OptionalPropertyHolder_init(); return OptionalPropertyHolder.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js index 97e03063a..98f50e850 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveParameters.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js index 871310bb8..e68e4e6a2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PrimitiveReturn.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js index fc13a471a..7bf565105 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/PropertyTypes.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -234,7 +234,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -244,7 +244,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyHolder_deinit, PropertyHolder.prototype); } - + constructor(intValue, floatValue, doubleValue, boolValue, stringValue, jsObject) { const stringValueBytes = textEncoder.encode(stringValue); const stringValueId = swift.memory.retain(stringValueBytes); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js index 24c02750f..ce9065ac4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Protocol.js @@ -95,7 +95,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -579,7 +579,7 @@ export async function createInstantiator(options, swift) { const ResultHelpers = __bjs_createResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); enumHelpers.Result = ResultHelpers; - + setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } @@ -600,7 +600,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -610,7 +610,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Helper_deinit, Helper.prototype); } - + constructor(value) { const ret = instance.exports.bjs_Helper_init(value); return Helper.__construct(ret); @@ -630,7 +630,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MyViewController_deinit, MyViewController.prototype); } - + constructor(delegate) { const ret = instance.exports.bjs_MyViewController_init(swift.memory.retain(delegate)); return MyViewController.__construct(ret); @@ -688,7 +688,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_DelegateManager_deinit, DelegateManager.prototype); } - + constructor(delegates) { const arrayCleanups = []; for (const elem of delegates) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js index e7bebfe6c..b79c6ebf4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.Global.js @@ -82,7 +82,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -267,7 +267,7 @@ export async function createInstantiator(options, swift) { const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); enumHelpers.APIResult = APIResultHelpers; - + setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } @@ -288,7 +288,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -298,7 +298,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype); } - + constructor() { const ret = instance.exports.bjs_MathUtils_init(); return MathUtils.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js index 8b5a54315..2f240c428 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticFunctions.js @@ -82,7 +82,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -267,7 +267,7 @@ export async function createInstantiator(options, swift) { const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); enumHelpers.APIResult = APIResultHelpers; - + setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } @@ -288,7 +288,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -298,7 +298,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_MathUtils_deinit, MathUtils.prototype); } - + constructor() { const ret = instance.exports.bjs_MathUtils_init(); return MathUtils.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js index 9806fc631..15edf8c60 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.Global.js @@ -36,7 +36,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -239,7 +239,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -249,7 +249,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype); } - + constructor() { const ret = instance.exports.bjs_PropertyClass_init(); return PropertyClass.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js index ee127ed07..d90e96f0e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StaticProperties.js @@ -36,7 +36,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -239,7 +239,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -249,7 +249,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PropertyClass_deinit, PropertyClass.prototype); } - + constructor() { const ret = instance.exports.bjs_PropertyClass_init(); return PropertyClass.__construct(ret); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js index 03a4bc9b1..fc67c0027 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringParameter.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js index 98ea9fa4a..50edf3b06 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/StringReturn.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js index d04cd6507..f3d5cafcb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClass.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -242,7 +242,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -252,7 +252,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype); } - + constructor(name) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); @@ -289,13 +289,13 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PublicGreeter_deinit, PublicGreeter.prototype); } - + } class PackageGreeter extends SwiftHeapObject { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_PackageGreeter_deinit, PackageGreeter.prototype); } - + } const exports = { Greeter, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js index 40378d042..59512a7eb 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosure.js @@ -133,7 +133,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -303,7 +303,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } - + bjs["invoke_js_callback_TestModule_10TestModule10HttpStatusO_Si"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); @@ -315,7 +315,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModule10HttpStatusO_Si"] = function(closurePtr) { return function(param0) { try { @@ -326,7 +326,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); @@ -345,7 +345,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModule5ThemeO_SS"] = function(closurePtr) { return function(param0) { try { @@ -361,7 +361,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModule5ThemeO_Sb"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); @@ -375,7 +375,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModule5ThemeO_Sb"] = function(closurePtr) { return function(param0) { try { @@ -388,7 +388,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModule6PersonC_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); @@ -405,7 +405,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModule6PersonC_SS"] = function(closurePtr) { return function(param0) { try { @@ -419,7 +419,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModule9APIResultO_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); @@ -436,7 +436,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModule9APIResultO_SS"] = function(closurePtr) { return function(param0) { try { @@ -451,7 +451,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); @@ -468,7 +468,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModule9DirectionO_SS"] = function(closurePtr) { return function(param0) { try { @@ -482,7 +482,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModule9DirectionO_Sb"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); @@ -494,7 +494,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModule9DirectionO_Sb"] = function(closurePtr) { return function(param0) { try { @@ -505,7 +505,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModuleSS_SS"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); @@ -524,7 +524,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModuleSS_SS"] = function(closurePtr) { return function(param0) { try { @@ -540,7 +540,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModuleSq5ThemeO_SS"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); @@ -564,7 +564,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModuleSq5ThemeO_SS"] = function(closurePtr) { return function(param0) { try { @@ -584,7 +584,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS"] = function(callbackId, param0IsSome, param0Value, param1IsSome, param1Value, param2IsSome, param2Value) { try { const callback = swift.memory.getObject(callbackId); @@ -620,7 +620,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModuleSq6PersonCSqSSSqSd_SS"] = function(closurePtr) { return function(param0, param1, param2) { try { @@ -642,7 +642,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModuleSq6PersonC_SS"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); @@ -664,7 +664,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModuleSq6PersonC_SS"] = function(closurePtr) { return function(param0) { try { @@ -679,7 +679,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModuleSq9APIResultO_SS"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); @@ -701,7 +701,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModuleSq9APIResultO_SS"] = function(closurePtr) { return function(param0) { try { @@ -722,7 +722,7 @@ export async function createInstantiator(options, swift) { } }; }; - + bjs["invoke_js_callback_TestModule_10TestModuleSq9DirectionO_SS"] = function(callbackId, param0IsSome, param0Value) { try { const callback = swift.memory.getObject(callbackId); @@ -744,7 +744,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModuleSq9DirectionO_SS"] = function(closurePtr) { return function(param0) { try { @@ -778,7 +778,7 @@ export async function createInstantiator(options, swift) { const APIResultHelpers = __bjs_createAPIResultValuesHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, textEncoder, swift); enumHelpers.APIResult = APIResultHelpers; - + setException = (error) => { instance.exports._swift_js_exception.value = swift.memory.retain(error) } @@ -799,7 +799,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -809,7 +809,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Person_deinit, Person.prototype); } - + constructor(name) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); @@ -822,7 +822,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_TestProcessor_deinit, TestProcessor.prototype); } - + constructor(transform) { const callbackId = swift.memory.retain(transform); const ret = instance.exports.bjs_TestProcessor_init(callbackId); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js index 9ab218df1..145eeb756 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftClosureImports.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; @@ -202,7 +202,7 @@ export async function createInstantiator(options, swift) { tmpRetOptionalHeapObject = undefined; return pointer || 0; } - + bjs["invoke_js_callback_TestModule_10TestModuleSi_Si"] = function(callbackId, param0Id) { try { const callback = swift.memory.getObject(callbackId); @@ -214,7 +214,7 @@ export async function createInstantiator(options, swift) { return 0; } }; - + bjs["lower_closure_TestModule_10TestModuleSi_Si"] = function(closurePtr) { return function(param0) { try { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js index dbeb70e69..f389900dc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStruct.js @@ -36,7 +36,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; const __bjs_createDataPointHelpers = () => { @@ -569,7 +569,7 @@ export async function createInstantiator(options, swift) { obj.registry.register(this, obj.pointer); return obj; } - + release() { this.registry.unregister(this); this.deinit(this.pointer); @@ -579,7 +579,7 @@ export async function createInstantiator(options, swift) { static __construct(ptr) { return SwiftHeapObject.__wrap(ptr, instance.exports.bjs_Greeter_deinit, Greeter.prototype); } - + constructor(name) { const nameBytes = textEncoder.encode(name); const nameId = swift.memory.retain(nameBytes); @@ -608,25 +608,25 @@ export async function createInstantiator(options, swift) { } const DataPointHelpers = __bjs_createDataPointHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.DataPoint = DataPointHelpers; - + const AddressHelpers = __bjs_createAddressHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.Address = AddressHelpers; - + const PersonHelpers = __bjs_createPersonHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.Person = PersonHelpers; - + const SessionHelpers = __bjs_createSessionHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.Session = SessionHelpers; - + const MeasurementHelpers = __bjs_createMeasurementHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.Measurement = MeasurementHelpers; - + const ConfigStructHelpers = __bjs_createConfigStructHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.ConfigStruct = ConfigStructHelpers; - + const ContainerHelpers = __bjs_createContainerHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.Container = ContainerHelpers; - + const exports = { Greeter, roundtrip: function bjs_roundtrip(session) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js index f4e7e61e9..afed321ce 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/SwiftStructImports.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; const __bjs_createPointHelpers = () => { @@ -252,7 +252,7 @@ export async function createInstantiator(options, swift) { const js = swift.memory.heap; const PointHelpers = __bjs_createPointHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.Point = PointHelpers; - + const exports = { }; _exports = exports; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js index 5a492295a..8a1c49647 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/Throws.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js index 2ac28b7e9..61f6c6cf3 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/UnsafePointer.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null; const __bjs_createPointerFieldsHelpers = () => { @@ -246,7 +246,7 @@ export async function createInstantiator(options, swift) { const js = swift.memory.heap; const PointerFieldsHelpers = __bjs_createPointerFieldsHelpers()(tmpParamInts, tmpParamF32s, tmpParamF64s, tmpParamPointers, tmpRetPointers, textEncoder, swift, enumHelpers); structHelpers.PointerFields = PointerFieldsHelpers; - + const exports = { takeUnsafeRawPointer: function bjs_takeUnsafeRawPointer(p) { instance.exports.bjs_takeUnsafeRawPointer(p); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js index f37cbd90b..053c55672 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/VoidParameterVoidReturn.js @@ -31,7 +31,7 @@ export async function createInstantiator(options, swift) { let tmpStructCleanups = []; const enumHelpers = {}; const structHelpers = {}; - + let _exports = null; let bjs = null;